Running a Pull-Through Mirror Registry
Configuring a local registry mirror as a pull-through cache for Docker Hub, reducing WAN bandwidth, bypassing rate limits, and configuring daemon.json registry-mirrors.
Published on • November 18, 2026
AI Assistant

In large development teams and CI/CD environments with hundreds of build nodes, repeatedly fetching base images directly from Docker Hub consumes massive WAN bandwidth and triggers strict Docker Hub pull rate limits (100–200 pulls per 6 hours).
A Pull-Through Mirror Registry acts as a local caching proxy. When a host requests an image, the mirror serves it from local disk if available; if missing, it fetches it from Docker Hub, caches the layers locally, and returns them to the client.
In this tutorial, we will learn how to configure the official registry:2 container image as a pull-through cache and configure client Docker daemons to use it transparently.
Pull-Through Cache Architecture
+---------------------+ 1. docker pull ubuntu:22.04 +-------------------------+
| Local Docker Host | -------------------------------------> | Pull-Through Mirror |
| (Client Daemon) | | (registry.internal:5000)|
+---------------------+ +-------------------------+
|
2. If layer missing locally |
fetches & caches v
+-------------------------+
| Docker Hub |
| (registry-1.docker.io) |
+-------------------------+
Key Benefits:
- Rate Limit Shield: Reduces outgoing requests to Docker Hub by up to 90%.
- Bandwidth Acceleration: Pulls popular base layers at gigabit local LAN speeds.
- Resilience: Allows local builds to continue even during temporary Internet outages if base images are cached.
Step 1: Deploying the Mirror Registry Container
To deploy registry:2 in proxy mode, pass REGISTRY_PROXY_REMOTEURL:
docker run -d \
-p 5000:5000 \
--name docker-hub-mirror \
--restart=always \
-v /opt/registry-cache:/var/lib/registry \
-e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io \
registry:2
Authenticating the Proxy to Docker Hub
To prevent your mirror from hitting anonymous Docker Hub rate limits when fetching cached images, supply authenticated credentials via environment variables:
docker run -d \
-p 5000:5000 \
--name docker-hub-mirror \
--restart=always \
-v /opt/registry-cache:/var/lib/registry \
-e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io \
-e REGISTRY_PROXY_USERNAME=myhubusername \
-e REGISTRY_PROXY_PASSWORD=dckr_pat_123456789... \
registry:2
Step 2: Configuring Client Docker Daemons
To instruct local Docker hosts to check the mirror before attempting to pull from Docker Hub, edit /etc/docker/daemon.json on each client machine:
{
"registry-mirrors": [
"http://registry.internal.net:5000"
]
}
Restart the Docker service:
sudo systemctl restart docker
Verify that the mirror was registered:
docker info | grep -A 2 "Registry Mirrors"
Sample output:
Registry Mirrors:
http://registry.internal.net:5000/
Step 3: Testing the Pull-Through Workflow
On any client machine configured with the mirror:
# Pull standard image directly without modifying the image name!
docker pull ubuntu:22.04
The Docker daemon automatically redirects the request to http://registry.internal.net:5000.
- First Pull: The mirror fetches
ubuntu:22.04from Docker Hub, saves it to/opt/registry-cache, and streams it back to the client. - Second Pull (from another server on the network): Served instantly from local cache at full network speed!
Important Constraints of Pull-Through Mirrors
- Docker Hub Only: The open-source
registry:2proxy mode supports caching requests destined for Docker Hub (registry-1.docker.io). It cannot proxy third-party private registries simultaneously. - Read-Only Proxy: A registry configured in proxy mode cannot accept
docker pushuploads. Use a separate registry instance for pushing custom images. - Cache Expiration: Upstream tag updates (e.g.
:latest) trigger manifest re-validation automatically based on HTTP header cache controls.
Summary
Setting up a pull-through mirror registry provides immediate performance gains for CI clusters and dev teams while insulating your organization against public registry rate limits.