Build and use a private docker repository.

Source: Internet
Author: User
Tags docker registry
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.