2

I use MAC OS X.And I want to use mirror in this tutorial, its step 1 is need to do this:

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

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

flag provided but not defined: --registry-mirror See 'docker --help'.

then, I use the other way in tutorial:

you may be able to 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 client 1.7.0. Can anyone tell me how to set up the mirror?.
I use this command to create 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 test it and find it didn't work like it describe that can download from local registry. Even if I fail to use this command :

docker push localhost:5000/batman/ubuntu

This command can work before, I really don't know what happened. Maybe the flag "STANDALONE=false" affect? I want to setup mirror, can anyone tell me how to do.Thanks.

v11
  • 2,124
  • 7
  • 26
  • 54

1 Answers1

5

The problem is the command:

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

Is intended for configuring the Docker daemon, not the Docker client. In boot2docker (which is what you're presumably using), this means you need to log into the boot2docker VM and run those commands there.

You can log into the boot2docker VM with boot2docker ssh. Whilst you could just stop the daemon and restart with the new commands, it's best to edit the file /var/lib/boot2docker/profile which will be used each time boot2docker restarts. Just add something like:

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

If you then restart boot2docker, you should be good to go.

Adrian Mouat
  • 44,585
  • 16
  • 110
  • 102
  • Hi,I have touch the file "profile", and add the line you said, but it still did't work, I can't pull image that I tag like "localhost:5000/hello-world" – v11 Jul 17 '15 at 03:46
  • Yeah, you've really asked two questions and I've answered the first one. The second one is why isn't your registry working, and I think you should probably open a new question for that, including any error messages from the docker logs for the registry container. – Adrian Mouat Jul 17 '15 at 08:45
  • Yeah, but I add variable to profile,but mirror didn't work yet. So, I think maybe using docker --registry-mirror=http:// -d.Is it right? – v11 Jul 17 '15 at 09:01
  • I have no idea what you mean. If you run `ps -ef` in the VM you should be able to see what flags the daemon is running with. – Adrian Mouat Jul 17 '15 at 09:03
  • Ok,Thanks for your answer. – v11 Jul 17 '15 at 09:04
  • What is it you're trying do? Creating a mirror is reasonably advanced usage and only relevant for multi-user environments normally. The docker daemon will cache images locally, so a mirror won't necessarily save you bandwidth if that's the issue. – Adrian Mouat Jul 17 '15 at 09:14
  • Hi, I try what you said, but it didn't work. Do you have any idea about it? I new a problem:http://stackoverflow.com/questions/31517388/how-to-create-docker-registry-mirror-on-centos. This problem bothering me for 3 days – v11 Jul 21 '15 at 07:51