Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy the Docker registry private image repository service

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to deploy the Docker registry private image repository service". In the daily operation, I believe many people have doubts about how to deploy the Docker registry private image repository service. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to deploy the Docker registry private image repository service". Next, please follow the editor to study!

Brief introduction

Docker-registry is an official tool that can be used to build a private image repository, which is created under the / var/lib/registry directory (the directory in the container) by default.

Registry case demonstration environment prepares hostname service IPdocker-client client (for uploading images) 192.168.117.130docker-server server (for storing images) 192.168.117.131 service deployment

Docker-server runs the registry container

# pull registry Image [root@docker-server ~] # docker pull registry# run registry Container [root@docker-server] # docker run-itd-p 5000Groupe 5000-- name= "myregistry"-v / registry:/var/lib/registry-- restart=always registry:latest be25cf74af26f017ea2e6398c9265db584e952211460b9582f54c79f5fdd1938# View Container [root@docker-server ~] # docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES be25cf74af26 registry:latest "/ entrypoint.sh / etc..." 37 seconds ago Up 37 seconds 0.0.0.0 5000/tcp myregistry 5000->

Docker-client pushes images to docker-server image repository

# take tomcat image as an example Add a TAG with private repository IP to this image [root@docker-client ~] # docker tag tomcat:latest 192.168.117.131:5000/tomcat:latest# modify the daemon file and restart docker [root@docker-client ~] # vim / etc/docker/daemon.json {"registry-mirrors": ["https://3290299n.mirror.aliyuncs.com"], # Note: use the upper and lower lines" "Segmentation # just add the following parameters Docker-server IP and port "insecure-registries": ["192.168.117.131 docker 5000"]} # restart docker service [root@docker-client ~] # systemctl restart docker# push image to private image repository [root@docker-client ~] # docker push 192.168.117.131:5000/tomcat:latest# verification: check whether there is 192.168 in the private image repository. 117.131:5000/tomcat:latest image [root@docker-client ~] # curl http://192.168.117.131:5000/v2/_catalog {"repositories": ["tomcat"]} # Delete 192.168.117.131:5000/tomcat:latest image

Docker-client downloads image 192.168.117.131:5000/tomcat:latest from private image repository

# docker-client Delete the local 192.168.117.131:5000/tomcat:latest image [root@docker-client ~] # docker rmi 192.168.117.131:5000/tomcat#docker-client View that there is only one tomcat image [root@docker-client ~] # docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat Latest 6fa48e047721 10 months ago 507MB#docker-client download 192.168.117.131:5000/tomcat image [root@docker-client ~] # docker pull 192.168.117.131:5000/tomcat# verify that the image was obtained successfully [root@docker-client ~] # docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.117.131:5000/tomcat latest 6fa48e047721 10 months ago 507MB tomcat latest 6fa48e047721 10 months ago 507MB to here The study on "how to deploy the Docker registry private image repository service" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report