Image Overview: ko
ReferenceChainguard ImagesProduct
On this page
stable
cgr.dev/chainguard/ko
Tags | Aliases |
---|---|
latest |
0 , 0.13 , 0.13.0 , 0.13.0-r7 |
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 cgr.dev
:
docker pull cgr.dev/chainguard/ko:latest
Usage
Using with CGO
Navigate to the example/
directory:
cd example/
Then run:
docker run --rm -it \
-v ${PWD}:/work \
--workdir=/work \
-e KO_DOCKER_REPO=example.com \
-e CGO_ENABLED=1 \
cgr.dev/chainguard/ko build ./ \
--push=false \
--preserve-import-paths
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.