Docker – How to change the default docker registry from docker.io to the private registry

dockerdocker-registry

By default, if I issue command:

sudo docker pull ruby:2.2.1

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

Best Answer

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

Then running:

docker pull <YOUR-DOMAIN>:8080/test-image