12

I am using docker-registry to pull my own docker images, but I want to do so without the need to specify the host. meanning: instead of writing:

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

I want to write:

docker pull <dockerImage>

and first it will try to pull the docker from my private registry, before trying to pull it from the public docker registry.

Is it possible?

I tried to change the DOCKER_INDEX_URL to [my_docker_registry_host]:[port], but it doesn't work.

Larry Cai
  • 55,923
  • 34
  • 110
  • 156
Muky
  • 3,584
  • 3
  • 19
  • 20

2 Answers2

5

You can modify or add your /etc/sysconfig/docker

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

then modify /etc/systemd/system/docker.service or /usr/lib/systemd/system/docker.service

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

when you pull a image,docker will pull it from your private registry first,and then docker hub if not found in your private registry.I am working on CentOS 7 Docker 1.12.

pigletfly
  • 1,051
  • 1
  • 16
  • 32
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.

Larry Cai
  • 55,923
  • 34
  • 110
  • 156
  • He wants to change the default public to his own registry. – Sedrik Aug 07 '14 at 06:45
  • I understand this since I want to this as well. But if goes this, it will confuse the system. They want to control this as unique kind of naming space. – Larry Cai Aug 07 '14 at 08:48
  • @LarryCai Display it exactly the same way, but have docker check a private repository first. In that scenario `ubuntu` would always be from the public repository. However, `docker run ubuntu` would install `privaterepo/ubuntu` if its available, but still show it as `privaterepo/ubuntu` – Reece45 Aug 12 '14 at 16:48
  • @Reece45 this could be a solution, you can leave there as one solution to see other's comments, and I still think it will mess-up the naming system ;-) – Larry Cai Aug 13 '14 at 00:58