Operations 3 min read

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.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Set Up a Self-Hosted Docker Registry Mirror with Automatic HTTPS

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:8080

2. Start the proxy

docker-compose up -d

3. Pull images through the proxy

docker pull your-domain/hello-world

Image illustrating the service UI:

image
image

4. Optionally add to Docker daemon configuration

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

After editing, reload and restart Docker:

systemctl daemon-reload && systemctl restart docker

Now you can pull images normally:

docker pull hello-world
image
image

Original article link: https://www.cnblogs.com/yuwen01/p/18743618 (copyright belongs to the original author).

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.

Operationsdocker-composeregistry-mirror
MaGe Linux Operations
Written by

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.

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.