code/autoregistry/README.md
2024-08-31 19:58:24 +02:00

1.1 KiB

Introduction

When developing with a local k8s cluster, images must be made available to a local registry. This involves tagging the images (e.g. localhost:5000/alpine) and then pushing them. Tagging is usually done transparently by e.g. docker compose build and it is easy to forget to push the images.

The autoproxy solves this problem by proxying for a local container registry. When an image is pulled it checkes whether or not the image is available in the container registry. If not, then it looks for the requested image in docker and does a push automatically. If the image is available in the registry the autoproxy checks is the images is the same as on the registry and if not it pushes it.

Usage

A test setup is in the compose.yaml file. In this setup:

  • a backend registry runs which is just a regular local container registry
  • the frontend service is the proxy for the backend

In the example setup images tagged with localhost:5000/... will automatically be pushed by the proxy in case they are requested.

k3d

k3d cluster create dev --registry-config registries.yaml