Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of building and using docker private warehouse

Shulou Source: shulou.com Published: 2022-06-01 03:37:37 09月22日 Update

This article introduces the relevant knowledge of "the construction and use of docker private warehouse". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Download the repository image

Docker pull registry

two。 Create a private warehouse container-d means the background starts

Docker run-d-p 5000UR 5000-v / opt/data/registry:/var/lib/registry registry

3. Firewall removes port 5000 restriction

Firewall-cmd-zone=public-add-port=5000/tcp-permanent

4. Verify whether the private warehouse has been started successfully

Http://192.3.8.12:5000/v2

5. Package image

Docker tag my-nginx:v1 192.168.56.200:5000/centos

6. Upload the packaged image to the private warehouse

[root@server1 ~] # docker push 192.168.56.200:5000/centosthe push refers to a repository [192.168.56.200:5000/centos] get https://192.168.56.200:5000/v1/_ping: http: server gave http response to https client

This problem may be due to the fact that the client uses https,docker registry instead of https services. One way to handle this is to change the customer's request for the address "192.168.56.200 http 5000".

Solution:

In the / etc/docker/ directory, create a "daemon.json" file. Write in the file: {"insecure-registries": ["192.168.56.200 insecure-registries 5000"]}

After saving and exiting, restart docker.

7. There is a problem again when uploading again, because selinux is not turned off. Use the setenforce 0 command to set temporary shutdown, or vi / etc/sysconfig/selinux to change the line inside to selinux=disabled and save it, and then restart it. )

8. View the images in the private repository

Http://192.3.8.187:5000/v2/_catalog

9. This downloads the image of the private repository on server2.

Docker pull 192.168.56.200:5000/centos

10. Backup and restore of warehouse images.

Directly back up / opt/data/registry on a regular basis, and restore can be started directly by hanging to the docker-registry image.

Docker run-d-p 5000 5000-v / opt/data/registry:/var/lib/registry registry "how to build and use docker private warehouse" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Warehouse private image method content backup customer file more knowledge problem practical successful successful next one line up and down again background command Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn Huawei Redmi NVidia