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.
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:80802. Start the proxy
docker-compose up -d3. Pull images through the mirror
docker pull your-domain/hello-world4. 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 dockerdocker pull hello-worldSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
