Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DoubleMalt/1613078cdaf8616ff63a to your computer and use it in GitHub Desktop.
Save DoubleMalt/1613078cdaf8616ff63a to your computer and use it in GitHub Desktop.
[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