DirectorySecurity advisories
Sign in

Directory

ko logo

ko

Last changed
Get started with latest for free
docker pull cgr.dev/chainguard/ko

Need access to a specific version? Contact us.

Sign in for updates

Get notified of upcoming product changes, critical vulnerability notifications and patches and more.

Sign in
Versions
Overview
Provenance
Specifications
SBOM
Vulnerabilities
Advisories

Minimal image to build and deploy Go applications using ko

Download this Image

The image is available on cgr.dev:

docker pull cgr.dev/chainguard/ko:latest

Usage

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.

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.

Licenses

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

View more

For a complete list of licenses, please refer to this Image's SBOM.

Software license agreement

Category
application
tools

Products

Chainguard Images

© 2024 Chainguard, Inc.