Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the tag appear to be tightly coupled to hostname of the registry?

Tags:

docker

I've been reading lot of tutorials on how to setup and use my own private docker registry.

One thing which stumped me is the fact that the tag I'm tagging the image with, appears to be tightly coupled to the hostname of the registry.

docker tag <imageid> registry.mycompany.com:5000/myrepo:tag
docker push registry.mycompany.com:5000/myrepo:tag

This seems really counter-intuitive. What happens if the registry has to move to a different hostname? Or if I'm using different hostnames whether or not I'm accessing the server internally/externally?

What seems more intuitive to me would be to specify the registry when pushing/pulling:

docker tag <imageid> myrepo:tag
docker push myrepo:tag --registry=registry.mycompany.com
docker pull myrepo:tag --registry=registry.mycompnay.com

What is the rationale for this? What key bit of information am I missing?

like image 215
Knut Saua Mathiesen Avatar asked May 04 '15 10:05

Knut Saua Mathiesen


1 Answers

The URL/registry name is essentially the "namespace" for the image. If you don't specify a registry, the image is assumed to belong to the Docker Hub. In effect, this means that Docker Inc controls the global namespace.

If it wasn't done this way, you could have two completely different "pushed" images on separate hosts with the same name, which is something Docker want to avoid.

The moving of the registry server is a valid concern, so I would suggest you try to use a domain name rather than IP for your registry.

like image 124
Adrian Mouat Avatar answered Oct 10 '22 04:10

Adrian Mouat