Docker recently introduced rate limitations on unauthorized pulls from DockerHub, making it more difficult to fetch images repeatedly without hitting pull limits. This repository provides a straightforward way to set up a local proxy cache that helps mitigate these rate-limit issues, especially in self-hosted or multi-system environments.
A Docker registry, operating in proxy mode, pulls images from DockerHub and saves them locally. Any subsequent requests for the same images are served by this cache, reducing the number of direct requests to DockerHub and helping to avoid rate limits.
- Docker Engine (configured system-wide)
- Docker Compose (for deployment)
- Optional: Valid SSL certificates for secure connections
- Clone this repository:
git clone https://github.com/drk1rd/dockerhub-cache-proxy.git cd dockerhub-cache-proxy
- Open the
config.yml
file and insert your DockerHub credentials to allow for authorized pulls. - Provide your SSL certificates (
server.chain.crt
andserver.key
) in the repository root or generate self-signed certificates if needed.
- Deploy the proxy registry:
docker compose up -d
- Configure your Docker clients by editing
/etc/docker/daemon.json
:{ "registry-mirrors": [ "https://dockerhub-cache.example.tld" ] }
- Restart the Docker daemon to apply the updated settings. From now on, Docker images fetched will be routed through the local cache.
- Use the
purge-cache.sh
script periodically to clear and recreate the cache if it becomes stuck or starts consuming excessive space. - Monitor logs and storage usage to ensure consistent performance.