Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.75 KB

File metadata and controls

44 lines (33 loc) · 1.75 KB

DockerHub Cache Proxy

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.

Overview

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.

Prerequisites

  • Docker Engine (configured system-wide)
  • Docker Compose (for deployment)
  • Optional: Valid SSL certificates for secure connections

Installation

  1. Clone this repository:
    git clone https://github.com/drk1rd/dockerhub-cache-proxy.git
    cd dockerhub-cache-proxy
  2. Open the config.yml file and insert your DockerHub credentials to allow for authorized pulls.
  3. Provide your SSL certificates (server.chain.crt and server.key) in the repository root or generate self-signed certificates if needed.

Usage

  1. Deploy the proxy registry:
    docker compose up -d
  2. Configure your Docker clients by editing /etc/docker/daemon.json:
    {
      "registry-mirrors": [
        "https://dockerhub-cache.example.tld"
      ]
    }
  3. Restart the Docker daemon to apply the updated settings. From now on, Docker images fetched will be routed through the local cache.

Maintenance

  • 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.