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