docker registry

Views:
 
Category: Education
     
 

Presentation Description

Docker registry server is used to manage our docker images. But my question is why we use own docker registry server instead of docker hub or third party? I think you know very well docker hub is providing limited space to upload docker images. After using that space, we have to take subscription to upload images that increase our cost. https://linuxdady.com/how-to-setup-docker-registry-server/

Comments

Presentation Transcript

slide 1:

LinuxDady.Com How to setup docker registry server locally step by step For more information visit https://linuxdady.com

slide 2:

How to setup docker registry image server locally Docker registry server is used to manage our docker images. But my question is why we use own docker registry server instead of docker hub or third party I think you know very well docker hub is providing limited space to upload docker images. After using that space we have to take subscription to upload images that increase our cost. If we will push and pull images from docker hub repository. Then we have to depend on internet all time but if we will set local repository then we can avoid cost and internet dependency. Docker registry Here we will setup local docker registry image server then we will pull and push images at registry server. But before setting local registry server be ready : ▪ With a separate machine or separate container where you want to setup registry in my case I will take separate container. ▪ If you will choose a dedicated container then you have to take volume to persistence image data. Docker registry server package If we want to setup docker registry image server first we have to install registry server package. But in our case we will pull docker registry pre- configured image from docker hub and launch a container that container we be our registry image server. But if you are using local machine instead of container than you have to install docker registry package. Launch a container for registry server First we are going to pull an image from docker hub then we will launch container from that image. We have pulled a pre-configure image no need to install any package. 5000 is our registry server port. 1 2 docker run -d -p 5000:5000 --restartalways --name registry registry:2 docker ps

slide 3:

Click Read: – How to mount external volume with container How to push image into docker registry image server We have successfully launched a container for registry images server. Now we are going to push image into it. First select your image that you want to push into registry server then tag that image with your machine IP or with domain name. Let’s see. 1 2 docker images docker tag 9f38484d220f 172.0.0.84:5000/centos:V1 Now let’s push tagged image at registry image server. 1 docker push 172.0.0.84:5000/centos:V1 But by default registry server use https protocol so first you have to upload https certificate otherwise it will show https error. We have an alternate way by which we can solve that http error without uploading certificate. Just follow us. 1 2 vim /etc/docker/daemon.json "insecure-registries":"172.0.0.84:5000"

slide 4:

After changing above parameter we have to take docker service restart to synchronize changes. Instead of server IP address we can use domain name if we have. 1 service docker restart We have disabled https protocol communication into our registry server now simply we can push our images. 1 docker push 172.0.0.84:5000/centos:V1 our image has been successfully upload into docker registry. So login to registry container and check it properly upload or not. 1 2 docker exec -it registry /bin/sh cd /var/lib/registry/docker/registry/v2/repositories Remember one things we have simply push a centos image. Still this image is not persistence if container incidental destroyed our images also permanently will destroyed. So for making our images data persistence we have to mount a volume and then we will push image into that volume. So ignore above step because in above step no external volume is mounted with container. let do it here. 1 docker run -d -v /volume:/var/lib/registry -p 5000:5000 --restartalways --name registry registry:2

slide 5:

Push image into registry server. When image pushed properly then check /volume directory. Image backup should be here. 1 2 docker push 172.0.0.84:5000/centos:V1 cd docker/registry/v2/repositories/ We have successfully pushed image into our registry server. Let have a demo and try to pull that image from our docker registry server. 1 2 docker pull 172.0.0.84:5000/centos:V1 docker images Click Read: – How to create docker image manually and from dockerfile Click Read: – How to manage docker networkig step by step We have pulled our image from registry server properly. So in your office infra if anyone ask for image just share image pull URL.

slide 6:

Conclusion In this tutorial we have setup local docker registry image server and resolved the issue that we are facing issue while setup. So Still if anyone have any query kindly write into comment box. I will try my best to resolve that query. Interview question of registry server 1. Explain benefit of using local repository instead of third party 2. What is default protocol of registry server 3. What is default port of registry server

authorStream Live Help