Skip to content

Instantly share code, notes, and snippets.

@g0t4
Created November 30, 2016 03:46
Show Gist options
  • Save g0t4/d5c9e446a51db3b591025fa2b75e99fc to your computer and use it in GitHub Desktop.
Save g0t4/d5c9e446a51db3b591025fa2b75e99fc to your computer and use it in GitHub Desktop.
Setting up a Docker Hub registry mirror on a Synology NAS

Instructions

  • Save the docker-compose.yml and config.yml in the same directory on one of your volumes on the NAS.
  • SSH in and use docker-compose up -d
  • Test the mirror with curl --head http://NAS-IP:55000
  • Start up docker daemons with the following option or put this in the daemon config file or copy into Docker for Mac/Windows settings. --registry-mirror=http://NAS-IP:55000
  • Pull an image and then check that it is cached in your mirror with curl http://NAS-IP:55000/v2/_catalog
    • or check that a large image isn't slow after the first pull :)

Notes

# This is the registry config file
# Config reference https://docs.docker.com/registry/configuration/ - see this if you want https
version: 0.1
# you might want to drop log level to just info once things are working
log:
level: debug
proxy:
remoteurl: https://registry-1.docker.io
storage:
filesystem:
rootdirectory: /var/lib/registry
http:
addr: 0.0.0.0:5000
version: '2'
# I'm using port 55000 as 5000 is used by the NAS web UI
# Notice that a config.yml file is mapped into the container, save that next to this docker-compose.yml
services:
hub-mirror:
image: registry:2
restart: unless-stopped
ports:
- 55000:5000
volumes:
- ./config.yml:/etc/docker/registry/config.yml
- hub-mirror:/var/lib/registry
# I'm using a named volume to persist the registry cache independent of the container lifespan
volumes:
hub-mirror:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment