Skip to content

Instantly share code, notes, and snippets.

@mysticaltech
Forked from giggio/docker-compose.yml
Created February 15, 2023 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mysticaltech/3a2d8d97d46090bb4b4bef064cdf0337 to your computer and use it in GitHub Desktop.
Save mysticaltech/3a2d8d97d46090bb4b4bef064cdf0337 to your computer and use it in GitHub Desktop.
Mirror Docker hub with Docker-compose
version: '3.7'
services:
dockerregistrymirror:
container_name: docker-registry-mirror
image: registry:2
ports:
- "443:443"
volumes:
- ./data/docker/var/lib/registry:/var/lib/registry
- ./data/certs:/certs
environment:
- TZ=America/Sao_Paulo
- REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io
- REGISTRY_HTTP_ADDR=0.0.0.0:443
- REGISTRY_HTTP_TLS_CERTIFICATE=/certs/my.crt
- REGISTRY_HTTP_TLS_KEY=/certs/my.key
- REGISTRY_STORAGE_DELETE_ENABLED=true
restart: always

On your docker config file, add the mirror:

{
  // other properties omitted, change the server name to your server
  "registry-mirrors": [
    "https://myserver.local"
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment