Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker pull/push using private registry without prefixing

Tags:

docker

nexus3

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

like image 946
MortenB Avatar asked Sep 28 '16 08:09

MortenB


People also ask

How do I pull a docker image from a private docker registry?

In order to pull images from your private repository, you'll need to login to Docker. If no registry URI is specified, Docker will assume you intend to use or log out from Docker Hub. Triton comes with several images built-in. You can view the available list with triton images .

Can you host your private docker registry?

One server will host your private Docker Registry and the other will be your client server. Docker installed on both servers by following Step 1 and 2 of How To Install and Use Docker on Ubuntu 20.04.

How do I push docker images from one registry to another?

To push any local image to Container Registry using Docker or another third-party tool, you need to first tag it with the registry name and then push the image.


2 Answers

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.

like image 97
Elton Stoneman Avatar answered Sep 20 '22 15:09

Elton Stoneman


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.

like image 36
Aleksei Avatar answered Sep 22 '22 15:09

Aleksei