如何将默认的 docker 注册表从 docker.io 更改为我的私有注册表? [英] How to change the default docker registry from docker.io to my private registry?
问题描述
默认情况下,如果我发出命令:
By default, if I issue command:
sudo docker pull ruby:2.2.1
默认会从 docker.io 官网拉取.
it will pull from the docker.io offical site by default.
Pulling repository docker.io/library/ruby
如何将其更改为我的私人注册表.这意味着如果我发出
How do I change it to my private registry. That means if I issue
sudo docker pull ruby:2.2.1
它将从我自己的私有注册表中拉取,输出类似于:
it will pull from my own private registry, the output is something like:
Pulling repository my_private.registry:port/library/ruby
推荐答案
UPDATE:根据您的评论,目前无法更改默认注册表,请参阅 这个问题 了解更多信息.
UPDATE: Following your comment, it is not currently possible to change the default registry, see this issue for more info.
您应该能够做到这一点,将主机和端口替换为您自己的:
You should be able to do this, substituting the host and port to your own:
docker pull localhost:5000/registry-demo
如果服务器是远程的/有身份验证,您可能需要使用以下命令登录服务器:
If the server is remote/has auth you may need to log into the server with:
docker login https://<YOUR-DOMAIN>:8080
然后运行:
docker pull <YOUR-DOMAIN>:8080/test-image
这篇关于如何将默认的 docker 注册表从 docker.io 更改为我的私有注册表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!