Skip to content

Instantly share code, notes, and snippets.

@loverde
Created August 16, 2016 19:45
Show Gist options
  • Save loverde/59e3052887bfcbe2ce285a6999ce8e02 to your computer and use it in GitHub Desktop.
Save loverde/59e3052887bfcbe2ce285a6999ce8e02 to your computer and use it in GitHub Desktop.
Docker Registry Example
# create a docker machine and run the registry on it
docker-machine create -d virtualbox box1
docker $(docker-machine config box1) run -d -p 5000:5000 --restart=always --name registry registry:2
# create the second docker machine referencing the insecure registry
docker-machine create -d virtualbox --engine-insecure-registry $(docker-machine ip box1):5000 box2
# on the second docker machine pull an image, login to the insecure registry (entry any login/password), tag, push the image, and then run the image
docker $(docker-machine config box2) pull alpine
docker $(docker-machine config box2) login $(docker-machine ip box1):5000
docker $(docker-machine config box2) tag alpine $(docker-machine ip box1):5000/myalpine
docker $(docker-machine config box2) push $(docker-machine ip box1):5000/myalpine
docker $(docker-machine config box2) run --rm -it $(docker-machine ip box1):5000/myalpine sh
# create a third docker machine referencing the insecure registry (skipped login here because the registry is insecure, but for a secured registry you would need to login first)
docker-machine create -d virtualbox --engine-insecure-registry $(docker-machine ip box1):5000 box3
docker $(docker-machine config box3) run --rm -it $(docker-machine ip box1):5000/myalpine sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment