Bobcares

Setup Docker Registry Mirroring

by | Jul 18, 2022

Docker registry mirroring Works when pictures are stored after being pulled from the public directory during a first-time user request.   

Bobcares answers all questions no matter the size, as part of our Docker hosting support Service

Let us take a look at docker registry mirroring in detail.

Use-case Docker registry mirroring

Each daemon connects to the internet and downloads an image it does not already have locally from the Docker repository if a user has several instances of Docker operating in their environment, such as multiple physical or virtual machines running Docker all at once. To prevent this additional internet traffic, the user can run a docker local registry mirror and direct all of your daemons there.

How does the Docker registry mirroring work?

When a user initially makes a request for an image from their registry mirror, firstly download the image from the open Docker registry. Store them locally before returning to the user. The local docker registry mirror is able to serve the picture from its own storage upon subsequent requests.

Setting up the pull-through Cache

configure the Docker daemon

Pass the ‘registry mirrors’ to the Docker daemon as a flag during startup or as a key/value pair in the daemon JSON configuration file.  This is the first step to docker registry mirroring.

Set up a pull-through cache registry

There are two forms of pull-through cache registry. Set up version using HTTP, and using HTTPS. In most circumstances, either choice is sufficient, but in other cases, the more secure option is more apt.

Requirements to set up a Docker Hub account

The user must first create a Docker Hub account before they can set up a pull-through cache registry. The pull-through cache registry will use this account to authenticate with Docker Hub. The docker registry will only startup when the authentication is completed.

Creating a separate account is the most efficient method. All end-users of the CircleCI server installation will have access to the resources that the account has access to. This is especially critical if the account has private Docker Hub images. So, all users of the CircleCI server installation will have access to these private images. This process can ensure the safety of the private images while the docker registry mirroring.

Set up an elementary pull-through cache registry (HTTP Proxy for Docker Hub)

Configure an independent Linux server with Docker. The docker registry is set up as a stand-alone server (i.e. outside of CircleCI boxes). It keeps the load on this cache registry from interfering with other CircleCI server services. Assuming that this server’s IP address is 192.0.2.1, the URL for the registry to set up is http://192.0.2.1. This URL will be required later on in order to arm Nomad clients and the VM Service. Start the registry by running the command below.

Replace DOCKER HUB USERNAME and DOCKER HUB ACCESS TOKEN with the username and access token for the Docker Hub account, respectively.

sudo docker run \
-d \
-p 80:5000 \
--restart=always \
--name=through-cache \
-e REGISTRY_PROXY_REMOTEURL="https://registry-1.docker.io" \
-e REGISTRY_PROXY_USERNAME=DOCKER_HUB_USERNAME \
-e REGISTRY_PROXY_PASSWORD=DOCKER_HUB_ACCESS_TOKEN \ registry

Finally, confirm that TCP port 80 (HTTP) is open and reachable. For better security, Open just the port to Nomad clients, VMs, and remote Docker engines.

[Need assistance with similar queries? We are here to help]

Conclusion

To conclude, the docker registry mirroring is the process that works when When a user requests an image from the local registry mirror for the first time. It retrieves the requested image from the public Docker registry and stores it locally before returning it to the user. The local registry mirror is able to serve the picture from its own storage upon subsequent requests.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.