obeoneorg/multi-registry-cache

By obeoneorg

β€’Updated about 1 month ago

Efficiently set up a multi-registry cache for faster Docker image pulls and reduced bandwidth usage.

Image
Networking
Integration & delivery
Developer tools
0

2.2K

obeoneorg/multi-registry-cache repository overview

⁠Multi-Registry Pull Through Cache πŸš€

Python Docker License Traefik Redis

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. Your config.yaml and 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

β πŸš€ Features

FeatureDescription
πŸ—οΈ Multi-RegistryMirror Docker Hub, GHCR, Quay, NVCR, or any OCI registry
πŸ”’ Private RegistryAdd a standalone private registry alongside your caches
🌐 Traefik ProxyAutomatic TLS termination and subdomain-based routing
⚑ Redis AccelerationBlob descriptor caching for faster repeated pulls
πŸ§™ Interactive WizardGuided setup command to generate your config.yaml
πŸ“¦ Installable CLIuvx, pipx, pip install, or Docker β€” your choice
☸️ K8s ReadyWorks with k3s, RKE2, containerd, dockerd
πŸ—„οΈ Flexible StorageFilesystem, S3, GCS, or in-memory backends
πŸ”§ CustomizableFull control over Traefik, registry, and Compose config via {name} interpolation
🌱 Eco-FriendlyLess external bandwidth = smaller carbon footprint

β πŸ“¦ Installation

MethodCommand
uvx (zero install)uvx multi-registry-cache setup
uv tooluv tool install multi-registry-cache
pipxpipx install multi-registry-cache
pippip install multi-registry-cache
DockerSee 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

β πŸ› οΈ Quick Start

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

β βš™οΈ CLI Reference

CommandDescription
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 --helpShow all commands

β πŸ”„ Configuring Container Runtimes

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…).

⁠containerd
# /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
⁠dockerd
{ "registry-mirrors": ["https://dockerhub.registry-cache.example.net"] }
sudo systemctl daemon-reload && sudo systemctl restart docker
⁠k3s / RKE2
# /etc/rancher/k3s/registries.yaml
mirrors:
  docker.io:
    endpoint: ["https://dockerhub.registry-cache.example.net"]
  ghcr.io:
    endpoint: ["https://ghcr.registry-cache.example.net"]

β πŸ“š Documentation

PageDescription
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

β πŸ“„ License

MIT β€” GrΓ©goire Compagnon⁠


Contributions welcome! Open an issue⁠ or submit a PR. πŸ‹

Tag summary

Content type

Image

Digest

sha256:2c33b41d7…

Size

262 Bytes

Last updated

about 1 month ago

docker pull obeoneorg/multi-registry-cache:sha256-fc219c2e9ffca64a7df74d458a497e6734b2b02072a62c826c5b4405e61e5593.sig