Chapter 5. Container images with Go Toolset
Go Toolset is available as container images for RHEL 7 and RHEL 8. They can be downloaded from the Red Hat Container Registry.
5.1. Images contents
The RHEL 7 and RHEL 8 container images provide content corresponding to the following packages:
| || |
5.2. Accessing the images
To pull the required image, run the following command as root:
- For the RHEL 7 container images:
# podman pull registry.redhat.io/devtools/go-toolset-rhel7
# podman pull registry.redhat.io/ubi7/go-toolset
Two RHEL 7 container images provide the same content.
- For the RHEL 8 container images:
# podman pull registry.redhat.io/rhel8/go-toolset
# podman pull registry.redhat.io/ubi8/go-toolset
Two RHEL 8 container images provide the same content.
5.3. Using as builder images with Source-to-Image
The Go toolset container image is prepared for use as a Source-to-Image (S2I) builder image.
To do so, set the following build environment variables:
Set this variable to a URL specifying the location of the code. The rules for the
go getcommand option apply.
Set this variable to a URL specifying the location of the package that will provide the application’s main executable file when built. The rules for the
go installcommand option apply.
This variable can be omitted if the main package location is identical with the location specified by the
Example 5.1. Building a Go application image using Source-to-Image
To build the md2man package from its GitHub repository:
$ s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' -e INSTALL_URL='github.com/cpuguy83/go-md2man' git://github.com/cpuguy83/go-md2man registry.access.redhat.com/devtools/go-toolset-rhel7 md2man-app
A locally available application image md2man-app is built from the repository on GitHub using the go-toolset container image.
To fully leverage the Go as a S2I builder image, build custom images based on it, with modified S2I assemble scripts and further modifications to accomodate the particular application being built.
A detailed description of the Go usage with Source-to-Image is beyond the scope of this document. For more information about Source-to-Image, see:
5.4. Additional Resources
- Go 1.12 container images - entries in the Red Hat Container Catalog
- Using Red Hat Software Collections Container Images