1. Download the repository Image
Docker pull Registry
2. Create a private repository container-D indicates that the background is started
Docker run-D-P 5000: 5000-V/opt/data/Registry:/var/lib/Registry
3. Remove port 5000 from the Firewall
Firewall-cmd -- zone = public -- add-Port = 5000/tcp -- Permanent
4. Verify that the private repository is successfully started.
Http: // 192.3.8.12: 5000/v2
5. Package the image
Docker tag my-nginx: V1 192.168.56.200: 5000/centos
6. Upload the packaged image to the private repository.
[[Email protected] ~] #Docker push 192.168.56.200: 5000/centos
The 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 occur because the client uses HTTPS and the docker registry does not use HTTPS services. One way is to change the customer's "192.168.56.200: 5000" request to HTTP.
Solution:
In"/Etc/docker/"Directory, create"Daemon. JSON"File. Write in the file:
{"Insecure-registries": ["192.168.56.200: 5000"]}
After saving and exiting, restart docker.
7. Another problem occurs during the upload, because SELinux is irrelevant. (UseSetenforce 0You can also disable the Command temporarily.VI/etc/sysconfig/SELinuxChange the line insideSELinux = disabledSave the changes and restart the instance .)
8. view images in a private Repository
Http: // 192.3.8.187: 5000/v2/_ catalog
9. In this way, the image of the private repository is downloaded on Server 2.
Docker pull 192.168.56.200: 5000/centos
10. backup and recovery of repository images.
Direct regular backup/Opt/data/Registry, The recovery is directly mounted to the docker-Registry image to start.
Docker run-D-P 5000: 5000-V/Opt/data/Registry:/Var/lib/Registry
Build and use a private docker repository.