Is there a way to use multiple docker registry proxy in cluster? - docker

My fellow mates and I encountered in a situation in which we'd like to have one computer with an internet connection (will be referred as HOST 1) to proxy multiple registries to few computers without internet connection (will be referred as CHILD HOST) but with a direct connection to HOST 1.
Registries Layout
General requirements
We'd like to pull images from dockerhub without any prefix (e.g. docker pull ubuntu and not docker pull localregistry:<someport>/ubuntu)
We'd like the local registry in HOST 1 to cache downloaded images from every registry
We'd like to be able to pull from multiple registries
From docker hub - docker pull ubuntu
From registry1 - docker pull registry1.dns/nameofimage
From registry2 - docker pull registry2.dns/nameofimage
What we have tried so far:
Docker private registry - we installed a docker private registry and added it to registry mirror, the disadvantages are that the private registry can only mirror one registry.
in order to cache & enable CHILD HOSTS to pull also docker hub images, we changed docker HTTP_PROXY to be the private registry, this led that we can only proxy 1 registry at a time.
Sonatype Nexus3 - we created proxy registries for docker-hub, registry1 and registry2. then we grouped them into nexus docker group and added the group registry to docker mirror registry, the disadvantages are that we weren't able to pull images from docker hub with docker pull ubuntu, we had to pull with docker pull <nexus3address>:<docker group port>/ubuntu of course that didn't work for us either.
We had tried to use https://hub.docker.com/r/tiangolo/docker-registry-proxy as well and we encountered the same issues as the above (required prefix for docker pull)
Any ideas?

Related

How to start docker registry as a local process, not run in container?

The official doc provides a way to run docker registry on containers, but given the situation that it is not allowed to run the registry in the container, how to start docker-registry without docker?
There are multiple options. You can use one of the following repository manager to easily setup a docker private registry and use that.
Sonatype nexus
GitLab container registry

where are the docker images stored when they are built on the host machine. Is it in a registry?

When we run the command docker image ls, a list of images on the host machine are listed. Are these images stored on some kind of registry on the local machine.
If yes, what is the name of registry.
Also, it is possible to create a registry on the host machine using some docker image for registry service in the form ip:5000. If this is created, will it be different from the first type of registry(docker image ls)
The question is mainly related to relation between registry and the images within it and not about the location on the file system
When you use docker image ls, it will show all your images in local, including the one which you use docker build & the one which you use docker pull.
On linux for example, they are by default stored in /var/lib/docker/{driver-name}, the driver-name could be overlay2, overlay, aufs, etc. But this called docker local images, not docker registry.
What is Docker registry?
The Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images. The Registry is open-source, under the permissive Apache license.
dockerhub is just one of the registry, if you do not want to use it, you of course could setup a private registry by yourself with next command:
docker run -d -p 5000:5000 --name registry registry:2
Then, you can push, pull from this registry, detail refers to official guide.

Need docker registry URL for mcr.microsoft.com

In our org, we have to use Nexus as proxy for downloading docker images from internet as our servers won't have internet connectivity.
I've setup proxy for Docker hub registry using URL ""
I want to setup proxy for the new MCR (mcr.microsft.com) registry.
Can someone please tell me what registry URL should i configure in my proxy server to be able to pull images from mcr through proxy...
instead of below command,
docker pull mcr.microsoft.com/dotnet/core/sdk
I want to be able to use
docker pull <IP_Of_Nexus_Proxy>:<Port_Of_Proxy>/dotnet/core/sdk
Below is working for me and pull image from docker hub
docker pull <IP_Of_Nexus_Proxy>:<Port_Of_Proxy>/hello-world

How to install kubernetes from local registry

I want to use local registery for my kubernetes. I can use How to access private Docker Hub repository from Kubernetes on Vagrant and it works i can pull my image from it but i should use
image: IP_OF_DOCKER_REGISTERY:5000/IMAGE_NAME
But i do not want it. i want to every image pull form my docker registery without assign any IP and port.
What should i do?
How can i use proxy?
What you're asking is not possible out-of-the-box with docker, if you want to use a registry different to Docker hub, you have to specify it as stated in the documentation.
$ docker pull <private_registry>/image_name:tag
Refer to this Github issue for more information

How to set a default registry to pull from in docker machine?

I have docker machine and by default it pulls my images from docker hub.
Now we have our own repo which can serve as a remote proxy to docker hub.
We can pull with docker pull server/repo/image.
Now I want that docker pull image resolves to our registry instead of docker hub. How can I achieve this in docker machine?
Changing the default docker registry is not possible. You can only configure a private registry to act as a mirror for the dockerhub registry as documented in Registry as a pull through cache.
Check moby-33069 issue which has requested this feature.
It can be done if you're using the Red Hat fork of Docker which is in their repo's, CentOS or EPEL not sure.
You use the --add-repository flag.
If I'm not mistaken you can also change the default repo if you build from source.

Resources