12

我正在使用 docker-registry 来提取我自己的 docker 映像,但我想这样做而不需要指定主机。意思:而不是写:

docker pull <host>:<port>/<dockerImage>

我想写:

docker pull <dockerImage>

首先它会尝试从我的私有注册表中提取 docker,然后再尝试从公共 docker 注册表中提取它。

可能吗?

我试图将 更改DOCKER_INDEX_URL[my_docker_registry_host]:[port],但它不起作用。

4

2 回答 2

5

您可以修改或添加您的/etc/sysconfig/docker

ADD_REGISTRY='--add-registry 192.168.0.169:5000'
INSECURE_REGISTRY='--insecure-registry 192.168.0.169:5000'

然后修改/etc/systemd/system/docker.service/usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd --registry-mirror=http://192.168.0.169:5000

当您拉取图像时,docker 将首先从您的私有注册表中拉取它,如果在您的私有注册表中找不到,然后再从 docker hub 拉取。我正在开发 CentOS 7 Docker 1.12。

于 2016-12-21T10:17:56.823 回答
1

No, I think it is not supported yet (1.1.2 as write). I guess main reasons is

The local private registry is not the mirror from the public registry, therefore the logical is not that if it can't be found locally, then it goes to public. They are totally different.

Therefore if we setup own private docker repository but keep the same naming, it will mess up.

When you do docker images, and you see ubuntu, how do you know it is from your local private registry or public.

UPDATE: add one sample case

Also if we have a Dockerfile, put the tomcatit use tomcat7 as base

FROM tomcat7

How do you know this build comes from ?

If we want to have strict process or control on the mapping between the private repo and public repo, it will be complicated.

Technically it is possible, but gain less. It loose the power of docker (community)

It is similar case for other package system which demands the unique name for the package.

于 2014-08-07T00:25:45.547 回答