How to deal with Docker private repository Registry and dockerregistry in minutes

Source: Internet
Author: User
Tags docker hub docker registry

How to deal with Docker private repository Registry and dockerregistry in minutes

1. What is the Docker private repository Registry?

The official Docker hub is a good place to manage public images. We can find the image we want and push our own images. However, sometimes our servers cannot access the Internet, or you do not want to put your images on the Internet, you need Docker Registry, which can be used to store and manage your own images.

Ii. Install Docker and Registry

To install Docker, see the previous blog:

Http://www.cnblogs.com/Javame/p/5492543.html

Install Registry:

Simply run a Registry container (including downloading images and starting containers and Services)

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

Iii. How to Use Registry

I have read other blog posts and often report the following errors:

unable to ping registry endpoint https://172.18.3.22:5000/v0/v2 ping attempt failed with error: Get https://172.18.3.22:5000/v2/: http: server gave HTTP response to HTTPS client

This is because the Registry requires https certificate support by default for security considerations.

However, we can solve the problem through a simple solution:

Modify the/etc/docker/daemon. json File

#vi /etc/docker/daemon.json
{    "insecure-registries": ["<ip>:5000"] }
#systemctl daemon-reload 
#systemctl restart docker
Note: <ip>: the ip address of the Registry machine. You must perform this step on the nodes that install the registry and the nodes that the client needs to access the private Registry.

4. Rename the image using the docker tag to match the registry

docker tag inits/nginx1.8 <ip>:5000/nginx1.8:latest

5. Upload the image to the Registry

docker push <ip>:5000/nginx1.8:latest

6. View information about all images in the Registry

curl http://<ip>:5000/v2/_catalog
Return Value:
{"Repositories": ["centos6.8", "jenkins1.638", "nginx", "redis3.0", "source2.0.3", "zkdubbo"]}

 

7. Download images from other Docker servers

docker pull <ip>:5000/nginx1.8:latest

8. Start the image

docker run -it <ip>:5000/nginx1.8:latest /bin/bash

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.