This repository contains tools to maintain a static container registry using nerdctl, a Docker-compatible CLI for containerd.
It targets an AWS-compatible S3 storage account and represents the path of least resistance on my setup – running MacOS on ARM M1 with containerd on my development system and using Kubernetes on DigitalOcean to run the container workloads.
To learn why/when you would use this, see my post container registry on a budget.
Jérôme Petazzoni's registrish uses
skopeo to extract image data and
supports additional targets. I don't use Docker and therefore couldn't use the
docker-daemon scheme with skopeo to work with local images.
Install the AWS CLI command-line tools. On MacOS you can use the awscli Homebrew formula.
Clone this repository or copy the main branch into your current working directory using:
curl -L https://github.com/malthe/static-container-registry/tarball/main | \
tar --strip-components=1 -xzThe starting point is to build or pull down an image locally.
For example, we can pull down Google's hello world example. For
convenience and because the upload script relies on them, we'll define
environment variables IMAGE and TAG first:
$ export IMAGE=gcr.io/google-samples/node-hello TAG=1.0
$ nerdctl pull $IMAGE:$TAGSave (export) this image to a temporary directory:
$ mkdir tmp
$ nerdctl save $IMAGE:$TAG | tar xv -C tmpDefine the following environment variables to prepare for the upload.
$ export AWS_ACCESS_KEY_ID=<access-key-id>
$ export AWS_SECRET_ACCESS_KEY=<secret-access-key>If using a non-AWS service such as DigitalOcean Spaces, additionally set the region and endpoint:
$ export AWS_DEFAULT_REGION=<region>
$ export ENDPOINT=--endpoint-url https://$AWS_DEFAULT_REGION.digitaloceanspaces.comThat's it. We are ready to upload:
$ ( cd tmp ; ../upload.sh )You can confirm that the registry was prepared correctly by pulling down the image. The exact image name will depend on which S3 service you're using.
$ nerdctl pull $BUCKET.$AWS_DEFAULT_REGION.digitaloceanspaces.com/$IMAGE:$TAGYou may need to specify your platform using --platform <name> if the
image was built for a different platform than your local machine.