如何将docker.io中的默认Docker注册表更改为我的私人注册表

问题描述:

默认情况下,如果我发出命令:

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


更新:在您的评论之后,目前无法更改默认注册表,请参阅此问题更多信息

您应该可以这样做,将主机和端口替换为您自己的:

You should be able to do this, substituting the host and port to your own:

docker pull localhost:5000/registry-demo

如果服务器是远程的/有auth你可能需要登录到服务器:

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