Docker pull/push using private registry without prefixing

℡╲_俬逩灬. 提交于 2019-12-12 09:39:54

问题


We are using Nexus3 docker groups (combining dockerhub proxy and private registry) aka:

docker pull dockerproxy:5002/busybox

trying to pull from dockerhub if it does not exist in private registry, push storing in private registry part. Works fine.

But how can I make:

docker pull busybox

go to this registry without having to prefix dockerproxy:5002 first?

An environment variable?, $HOME/.docker/config.json? Creative tagging?

Thanks


回答1:


Docker support mirrors of docker.io hub https://docs.docker.com/registry/recipes/mirror/:

edit /etc/docker/daemon.json and add the registry-mirrors key and value, to make the change persistent.

{ "registry-mirrors": ["https://dockerproxy:5002"] }

Save the file and reload Docker for the change to take effect.

Now docker pull busybox from your nexus proxy.




回答2:


No, the registry address is part of the full tag for the image. If you don't specify an address, Docker Hub is assumed, and you can't change to a different default.

There's no way around it (short of building your own Docker Engine) - it's a deliberate design decision:

this would lead to a situation where docker pull ubuntu could mean two different things for two different persons/installs, that would very bad for the user. It would lead to a fragmentation of the ecosystem and break the community.



来源:https://stackoverflow.com/questions/39741501/docker-pull-push-using-private-registry-without-prefixing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!