Skip to content

Instantly share code, notes, and snippets.

@sheldonh
Last active March 2, 2016 08:55
Show Gist options
  • Save sheldonh/e3bb239dbf81586df641 to your computer and use it in GitHub Desktop.
Save sheldonh/e3bb239dbf81586df641 to your computer and use it in GitHub Desktop.
Docker registry mirror systemd service unit file
[Unit]
Description=Docker registry mirror
After=docker.service
Requires=docker.service
[Service]
Environment=UNIT=docker-registry-mirror
TimeoutStartSec=0
ExecStartPre=/usr/bin/docker pull registry
ExecStartPre=-/usr/bin/docker run --name ${UNIT}-dvc -v /tmp/registry busybox true
ExecStartPre=-/usr/bin/docker rm ${UNIT}
ExecStart=/usr/bin/docker run --name ${UNIT} \
-e MIRROR_SOURCE=https://registry-1.docker.io \
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
-e MIRROR_TAGS_CACHE_TTL=2592000 \
-p 5000:5000 \
--volumes-from ${UNIT}-dvc \
registry
ExecStop=/usr/bin/docker stop ${UNIT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment