Build Go Containers with Ko
In this tutorial, you'll learn how to build minimal Go Containers using Ko and Chainguard base images
Harbor is an open-source artifact registry. It’s designed to securely store, manage, and distribute OCI artifacts, including container images and Helm charts by enforcing policies like vulnerability scanning, image signing, and role-based access control. Harbor delivers enterprise-grade compliance, performance, and interoperability across platforms like Kubernetes and Docker, all accessible via a web UI or RESTful API.
This tutorial outlines how to sync images from Chainguard’s registry to a Harbor instance. It describes two approaches:
You need the following in order to complete this tutorial:
chainctl
— Chainguard’s command-line interface — installed on your local machine. If you don’t have chainctl
installed, refer to our How to Install chainctl
guide to set this up.Before configuring a proxy cache or replication rule, you must create a registry endpoint for the Chainguard registry.
If you don’t already have one, generate a pull token in your organization:
chainctl auth configure-docker --parent <org-name> --pull-token
This returns username and password credentials:
To use this pull token in another environment, run this command:
docker login "cgr.dev" --username "<pull-token-username>" --password "<pull-token-password>"
Take note of these values, as you’ll need them shortly.
Next, open up the Harbor UI and perform the following steps:
Docker Registry
provider type.cgr.dev
.https://cgr.dev
.chainctl auth
command you just ran.chainctl auth
command.cgr.dev
successfully.After creating the endpoint, you can move on to creating a proxy cache.
A proxy cache allows Harbor to proxy and cache images from the Chainguard registry.
To configure a cache, perform the following steps in the Harbor UI:
cgr—proxy
.docker login
is not required.-1
for unlimited or set as required.-1
for unlimited or set as required.Following that, you can pull images from the Harbor project like so:
docker pull $HARBOR_URL/cgr-proxy/$ORGANIZATION/$IMAGE:$TAG
Be sure to replace the placeholder values ($HARBOR_URL
, $ORGANIZATION
, $IMAGE
, and $TAG
) to reflect your own setup.
A replication rule is an alternative approach to a proxy cache. This section outlines how to configure a replication rule that copies images from the Chainguard registry to a Harbor project.
First, create a project:
cgr—mirror
.docker login
is not required.-1
for unlimited or set as required.Then, perform the following steps to create a new replication rule:
cgr-mirror
.Pull-based
.cgr.dev
endpoint.<org-name>/*
.Flatten All Levels
. This removes the organization name from the path.Scheduled
to run the replication regularly or Manual
to trigger on an ad hoc basis.-1
for unlimited or set as required.To trigger the replication manually, select the cgr-mirror
rule in the table and click the REPLICATE button. Then, navigate to Projects > cgr-mirror and observe images populating.
You should be able to pull images from the project like this:
docker pull $HARBOR_URL/cgr-mirror/$IMAGE:$TAG
Again, be sure to replace this command’s placeholder values as necessary.
If you haven’t already done so, you may find it useful to review our Registry Overview to learn more about Chainguard’s registry. You can also learn more about Chainguard Containers by checking out our Containers documentation.
Additionally, if you’d like to learn more about Harbor, we encourage you to refer to the official Harbor documentation.
Last updated: 2025-08-19 12:00