如何创建docker注册表镜像 [英] How to create docker registry mirror

查看:542
本文介绍了如何创建docker注册表镜像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MAC OS X.然后我想在这个教程中使用镜像步骤1需要这样做:

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:


提供但未定义的标志:--registry-mirror请参阅'docker --help'。

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

然后,我在教程中使用另一种方式:

then, I use the other way in tutorial:


你可以添加--registry-mirror选项到
DOCKER_OPTS变量/ etc / default / docker

you may be able to add the --registry-mirror options to the DOCKER_OPTS variable in /etc/default/docker

我不知道在哪里添加这个DOCKER_OPTS。我想在客户端1.7.0中使用镜像。任何人都可以告诉我如何设置镜子?

我使用此命令创建镜像:

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

此命令可以工作,我真的不知道发生了什么。也许标志STANDALONE = false影响?我想设置镜像,任何人都可以告诉我如何做。谢谢。

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.

推荐答案

问题是命令:

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

用于配置Docker守护程序,而不是Docker客户端。在boot2docker(这是你可能使用的),这意味着你需要登录到boot2docker VM并在那里运行那些命令。

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.

你可以登录boot2docker VM与 boot2docker ssh 。虽然您可以停止守护程序并重新启动新的命令,最好编辑文件 / var / lib / boot2docker / profile ,每次boot2docker重新启动时将使用该文件。只需添加以下内容:

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>"

如果您重新启动boot2docker,您应该很好去。

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

这篇关于如何创建docker注册表镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆