How to Set Up a Self-Hosted Docker Registry Mirror with Automatic HTTPS
This guide explains how to deploy a multi‑platform Docker registry proxy using Docker Compose, configure automatic HTTPS certificates, and optionally add the mirror to Docker's daemon settings for seamless image pulling from various registries.
Preparation
⚠️ Important: Use a foreign server (e.g., Tencent Cloud special‑offer) that is not blocked, with a cheap domain (e.g., ending with .xyz, first year as low as ¥7). Ensure the domain's A and * records point to the server; the script can automatically obtain HTTPS certificates.
Deploy with Docker Compose (auto HTTPS)
⚠️ Prerequisite: Have a domain with DNS resolved to the server IP.
1. Create docker-compose.yaml
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 if the server cannot reach target registries
#environment:
#- https_proxy=http://proxy:8080
#- http_proxy=http://proxy:80802. Start the proxy
docker-compose up -d3. Pull images through the proxy
docker pull your-domain/hello-worldImage illustrating the service UI:
4. Optionally add to Docker daemon configuration
{
"registry-mirrors": [
"https://your-domain"
]
}After editing, reload and restart Docker:
systemctl daemon-reload && systemctl restart dockerNow you can pull images normally:
docker pull hello-worldOriginal article link: https://www.cnblogs.com/yuwen01/p/18743618 (copyright belongs to the original author).
Signed-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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
