docker pull cgr.dev/chainguard/go
Need access to a specific version? Contact us.
Get notified of upcoming product changes, critical vulnerability notifications and patches and more.
Sign inContainer image for building Go applications.
The image is available on cgr.dev
:
In Go 1.20, we default to using the new GODEBUG
settings of tarinsecurepath=0
and zipinsecurepath=0
. These can be disabled by clearing the GODEBUG
environment variable, or by setting them to 1
.
Learn more about these settings in the Go release notes.
This section contains two examples of how you can use the Go Chainguard Image to build an example Go application. For more information on working with this Image, check out our Getting Started with the Go Chainguard Image guide.
Many Image directories in the public Chainguard Images GitHub repository, including the one for the Go Image, contain examples you can run to test out the given Image.
You can build the Go application in tests/hello/main.go using the host architecture of your local machine by cloning the GitHub repository and then navigating to the /images/go/
directory.
From there, run the following command:
The example application will be built to ./hello
:
The following example Dockerfile builds a hello-world program in Go and copies it on top of the cgr.dev/chainguard/static:latest
base image:
Run the following command to build the demo image and tag it as go-hello-world
:
Now you can run the image with:
You should get output like this:
It’s worth noting how small the resulting image is:
Chainguard Images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" version of this image:
Apache-2.0
BSD-2-Clause
BSD-3-Clause
GCC-exception-3.1
GPL-2.0-only
GPL-2.0-or-later
GPL-3.0-or-later
For a complete list of licenses, please refer to this Image's SBOM.
Software license agreementProducts
Chainguard Images© 2024 Chainguard, Inc.