Efficiently set up a multi-registry cache for faster Docker image pulls and reduced bandwidth usage.
2.2K
Generate a complete Docker Compose stack with pull-through caches for multiple container registries, fronted by Traefik and accelerated by Redis.
β οΈ Migrating from v1.x scripts?
See the upgrade guideβ . TL;DR:
python setup.pyβmulti-registry-cache setup,python generate.pyβmulti-registry-cache generate. Yourconfig.yamland Docker usage are fully compatible.
flowchart TB
subgraph Clients
D[Docker / containerd]
K[Kubernetes nodes]
end
subgraph Cache Stack
T[Traefik Proxy<br>TLS + routing]
R1[Registry: docker.io]
R2[Registry: ghcr.io]
R3[Registry: quay.io]
RN[Registry: ...]
RE[Redis<br>blob cache]
end
subgraph Upstream
U1[(Docker Hub)]
U2[(GHCR)]
U3[(Quay)]
UN[(...)]
end
D & K -->|pull| T
T --> R1 & R2 & R3 & RN
R1 & R2 & R3 & RN --> RE
R1 -.->|cache miss| U1
R2 -.->|cache miss| U2
R3 -.->|cache miss| U3
RN -.->|cache miss| UN
| Feature | Description |
|---|---|
| ποΈ Multi-Registry | Mirror Docker Hub, GHCR, Quay, NVCR, or any OCI registry |
| π Private Registry | Add a standalone private registry alongside your caches |
| π Traefik Proxy | Automatic TLS termination and subdomain-based routing |
| β‘ Redis Acceleration | Blob descriptor caching for faster repeated pulls |
| π§ Interactive Wizard | Guided setup command to generate your config.yaml |
| π¦ Installable CLI | uvx, pipx, pip install, or Docker β your choice |
| βΈοΈ K8s Ready | Works with k3s, RKE2, containerd, dockerd |
| ποΈ Flexible Storage | Filesystem, S3, GCS, or in-memory backends |
| π§ Customizable | Full control over Traefik, registry, and Compose config via {name} interpolation |
| π± Eco-Friendly | Less external bandwidth = smaller carbon footprint |
| Method | Command |
|---|---|
| uvx (zero install) | uvx multi-registry-cache setup |
| uv tool | uv tool install multi-registry-cache |
| pipx | pipx install multi-registry-cache |
| pip | pip install multi-registry-cache |
| Docker | See below |
# Docker β interactive setup
docker run --rm -ti -v "./config.yaml:/app/config.yaml" obeoneorg/multi-registry-cache setup
# Docker β generate compose/ from an existing config.yaml
docker run --rm -v "./config.yaml:/app/config.yaml" -v "./compose:/app/compose" obeoneorg/multi-registry-cache generate
flowchart LR
A["1οΈβ£ setup"] --> B["2οΈβ£ edit config"] --> C["3οΈβ£ generate"] --> D["4οΈβ£ docker compose up"]
# 1. Create config interactively
multi-registry-cache setup
# 2. Fine-tune config.yaml (TLS, storage, hostnamesβ¦)
# See docs/configuration.md
# 3. Generate the stack
multi-registry-cache generate
# 4. Start
cd compose && docker compose up -d
| Command | Description |
|---|---|
multi-registry-cache setup [--config PATH] | Interactive wizard β config.yaml |
multi-registry-cache generate [--config PATH] [--output-dir DIR] | Read config β generate compose/ |
multi-registry-cache completion [zsh|bash|fish] | Print shell completion script |
multi-registry-cache --help | Show all commands |
Point your container runtime at the cache after deploying the stack. Quick examples below β see docs/runtime-configuration.mdβ for full instructions (nerdctl, RKE2, BuildKit, Docker Desktopβ¦).
# /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["https://dockerhub.registry-cache.example.net"]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."ghcr.io"]
endpoint = ["https://ghcr.registry-cache.example.net"]
sudo systemctl restart containerd
{ "registry-mirrors": ["https://dockerhub.registry-cache.example.net"] }
sudo systemctl daemon-reload && sudo systemctl restart docker
# /etc/rancher/k3s/registries.yaml
mirrors:
docker.io:
endpoint: ["https://dockerhub.registry-cache.example.net"]
ghcr.io:
endpoint: ["https://ghcr.registry-cache.example.net"]
| Page | Description |
|---|---|
| Architectureβ | Data flow, interpolation system, Redis DB assignment |
| Configurationβ | Complete config.yaml reference |
| CLI referenceβ | All commands, options, shell completion |
| Storage backendsβ | inmemory, filesystem, S3, GCS |
| TLS & SSLβ | Let's Encrypt, ACME, BYO cert, HTTP-only |
| Runtime configurationβ | containerd, dockerd, k3s, BuildKit |
| Internalsβ | Source code walkthrough, running tests |
| Contributingβ | Dev setup, commit conventions, PR process |
| Upgrading to v2.0.0β | Migrate from the old script-based version |
MIT β GrΓ©goire Compagnonβ
Contributions welcome! Open an issueβ or submit a PR. π
Content type
Image
Digest
sha256:2c33b41d7β¦
Size
262 Bytes
Last updated
about 1 month ago
docker pull obeoneorg/multi-registry-cache:sha256-fc219c2e9ffca64a7df74d458a497e6734b2b02072a62c826c5b4405e61e5593.sig