How to create a docker registry mirror

I am using MAC OS X. And I want to use mirror in this tutorial , its step 1 needs to be done:

docker --registry-mirror=http://<my-docker-mirror-host> -d

      

But when I use this command in terminal it doesn't work:

flag supplied but not defined: -registry-mirror See "docker -help".

then I use a different path in the tutorial:

you can add the -registry-mirror options to the DOCKER_OPTS variable in / etc / default / docker

I don't know where to add this DOCKER_OPTS. I want to use mirror in 1.7.0 client. Can anyone tell me how to set up a mirror ?.
I am using this command to create a mirror:

docker run -d -p 5000:5000 -e REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/Users/v11/Documents/docker-registry --restart=always --name mirror -e STANDALONE=false -e MIRROR_SOURCE=https://registry-1.docker.io -e MIRROR_SOURCE_INDEX=https://index.docker.io registry

      

I am testing it and find it doesnt work as described, which can be downloaded from the local registry. Even if I can't use this command:

docker push localhost:5000/batman/ubuntu

      

This command may have worked before, I really don't know what happened. Maybe the flag "STANDALONE = false" affects? I want to set up a mirror, can someone tell me how to do this. Thank.

+1


source to share


1 answer


The problem is with the command:

$ docker --registry-mirror=http://<my-docker-mirror-host> -d

      

Designed for configuring the Docker daemon, not the Docker client. In boot2docker (which is what you are probably using), this means you need to login to boot2docker VM and run these commands there.



You can log into the boot2docker virtual machine with boot2docker ssh

. While you can just stop the daemon and restart it with the new commands, your best /var/lib/boot2docker/profile

bet is to edit the file that will be used every time boot2docker is rebooted. Just add something like:

EXTRA_ARGS="--registry-mirror=http://<my-docker-mirror-host>"

      

If you restart boot2docker you should be good to go.

+4


source







All Articles