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

Detailed explanation of Ubuntu Docker Registry to build a private warehouse

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Server version Ubuntu 16.04LTS.

Installation commands:

The copy code is as follows:

$docker run-d-v / opt/registry:/var/lib/registry-p 5000 restart=always-- name registry registry

The Registry service saves the image in the / var/lib/registry directory by default. The above command sets the storage directory under / opt/registry. We can take a look at the status of the Registry container:

$docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe2b1ffd9072e registry "/ entrypoint.sh / e..." 2 hours ago Up About an hour 0.0.0.0pur5000-> 5000/tcp stoic_davinci

Next, we log in to another server and push the existing local image files to the private repository. First, we need to mark the tag of the image to be pushed to the private warehouse. For example:

$docker tag hwapp:v2 40.125.207.78:5000/hwapp:v3

Then, let's take a look at the list of image files:

$docker imagesdocker imagesREPOSITORY TAG IMAGE ID CREATED SIZE40.125.207.78:5000/hwapp v3 fe28b19b4410 24 hours ago 1.63GBhwapp v2 fe28b19b4410 24 hours ago 1.63GBhwapp v1 8a28e2e870d4 25 hours ago 1.63GBmicrosoft/aspnetcore latest 0f2330f1a843 26 hours ago 280MBmicrosoft/dotnet latest a7dd4972fc95 6 days ago 1.63GB

Finally, we can push the 40.125.207.78:5000/hwapp:v3 image file to the private repository:

$docker push 40.125.207.78:5000/hwapp:v3

The following error may occur:

$docker push 40.125.207.78:5000/hwapp:v3

The push refers to a repository [40.125.207.78:5000/hwapp]

Get https://40.125.207.78:5000/v1/_ping: http: server gave HTTP response to HTTPS client

The solution is to operate on this server instead of the server where the private warehouse is located (if you already have a daemon.json file, you can modify it):

$touch / etc/docker/daemon.json$ echo'{"insecure-registries": ["40.125.207.78 etc/docker/daemon.json$ service docker restart"]}'> / etc/docker/daemon.json$ service docker restart

Then, execute the push command, or we can directly build an image to push the private repository, for example:

$docker build-t 40.125.207.78:5000/hwapp:v4.

Then, execute the push command:

$docker push 40.125.207.78:5000/hwapp:v4

After the push is successful, we can check the image files in the private repository:

$curl http://40.125.207.78:5000/v2/_catalog{"repositories":["hwapp"]}$ curl http://40.125.207.78:5000/v2/hwapp/tags/list{"name":"hwapp","tags":["v3","v4"]}

Then, we can pull the image file in the private repository:

$docker pull 40.125.207.78:5000/hwapp:v4

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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

Servers

Wechat

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

12
Report