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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With