Image Overview: ko

Overview: ko Chainguard Image

This is an image that contains ko, go, and build-base.

This image is designed for use in situations where you would like to use ko with codebases that have C dependencies where cgo must be used. In these cases, staticly linking against musl instead of glibc results in smaller binaries.

Get It!

The image is available on

docker pull


Using with CGO

Navigate to the example/ directory:

cd example/

Then run:

docker run --rm -it \
  -v ${PWD}:/work \
  --workdir=/work \
  -e \
  -e CGO_ENABLED=1 \ build ./ \
    --push=false \

This will build the example program, but not push it, due to --push=false.

To push, you will need to mount in your Docker config to provide auth by adding:

  -v $DOCKER_CONFIG:/docker-config \
  -e DOCKER_CONFIG=/docker-config \

If you’re using Docker credential helpers, those will need to be made available in the container as well so that ko can invoke them.