Operations 4 min read

Build a Fast Docker Registry Mirror with Docker‑Compose and Auto‑HTTPS

This guide shows how to set up a self‑hosted multi‑platform Docker image proxy with Docker‑Compose, automatically obtain HTTPS certificates, and configure Docker to pull images through the new registry mirror for faster and reliable pulls.

Raymond Ops
Raymond Ops
Raymond Ops
Build a Fast Docker Registry Mirror with Docker‑Compose and Auto‑HTTPS

docker-proxy 镜像加速仓库

https://github.com/kubesre/docker-registry-mirrors

Self‑hosted multi‑platform container image proxy service, supporting Docker Hub, GitHub, Google, Kubernetes, Quay, Microsoft and other registries.

Preparation

⚠️ Important: Use a foreign server (e.g., a Tencent Cloud promotional server) that is not blocked, with a cheap domain (e.g., ending with .xyz, first year as low as ¥7). The script can automatically configure HTTPS.

Before running the script, ensure the domain’s A and * records point to the server’s IP.

Deploy with Docker Compose (automatic HTTPS)

⚠️ Prerequisite: Have a domain and DNS resolved to the server’s IP.

1. Create docker-compose.yaml on the server

version: '3'
services:
  crproxy:
    image: ghcr.io/daocloud/crproxy/crproxy:v0.9.1
    container_name: crproxy
    restart: unless-stopped
    ports:
      - 80:8080
      - 443:8080
    command: |
      --acme-cache-dir=/tmp/acme
      --acme-hosts=*
      --default-registry=docker.io
    tmpfs:
      - /tmp/acme
    # optional proxy settings
    # environment:
    # - https_proxy=http://proxy:8080
    # - http_proxy=http://proxy:8080

2. Start the proxy

docker-compose up -d

3. Pull images through the mirror

docker pull your-domain/hello-world
Proxy UI
Proxy UI

4. Add the mirror to /etc/docker/daemon.json

{
  "registry-mirrors": [
    "https://your-domain"
  ]
}

After modifying the configuration, reload and restart Docker.

systemctl daemon-reload && systemctl restart docker
Docker pull test
Docker pull test
docker pull hello-world
Pull result
Pull result
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

HTTPSDocker ComposeContainer Registryregistry-mirror
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.