Skip to content

Instantly share code, notes, and snippets.

@mbentley
Created March 12, 2015 13:41
Show Gist options
  • Save mbentley/dd1bb4c522eff9d30274 to your computer and use it in GitHub Desktop.
Save mbentley/dd1bb4c522eff9d30274 to your computer and use it in GitHub Desktop.
docker registry mirror
#!/bin/bash
# lists of images to cache
base_images="busybox:latest debian:wheezy debian:jessie ubuntu:14.04 golang:1.3-cross"
dhe="dockerhubenterprise/admin-server dockerhubenterprise/log-aggregator dockerhubenterprise/distribution dockerhubenterprise/nginx"
dhedev="dockerhubenterprise/log-aggregator-dev dockerhubenterprise/admin-server-dev dockerhubenterprise/nginx-dev dockerhubenterprise/garant dockerhubenterprise/distribution"
# pull lists together
images="${base_images} ${dhe} ${dhedev}"
# loop through the list of images to pull each
for i in $images
do
docker pull ${i}
done
# remove the images because we don't really need them on the local docker engine; ignore the registry image
docker rmi $(docker images | grep -v REPOSITORY | grep -v registry | awk '{print $3}' | sort | uniq)
docker run -d -p 5000:5000 --name registry-mirror -e STANDALONE=false -e MIRROR_SOURCE=https://registry-1.docker.io -e MIRROR_SOURCE_INDEX=https://index.docker.io -e LOGLEVEL=info -e DEBUG=false registry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment