1. # Docker Pull Registry//download Registry image, registry an image for Docker, we can use it to create a local Docker private repository.
2, # Docker run-d-P 5000:5000 Registry//Start container with Registry mirror, listen to 5000 ports
# docker exec-it a9f Bash//host and container monitor 5000 ports at the same time
3. # Curl 127.0.0.1:5000//can access it
Access result: "\" Docker-registry server\ ""
4. Upload the image to the private repository:
Download a busybox (very small, easy to test) image first
# Docker Pull BusyBox
# docker Tag BusyBox 10.10.10.201:5000/busybox//Tag the tag, you must have a private warehouse Ip:port
Upload images to a private repository:
# Docker Push 10.10.10.201:5000/busybox
The following error message will be shown (if the IP address is not written on a local IP):
Error response from Daemon:invalid registry endpoint "Http://10.10.10.201:5000/v0/". HTTPS attempt:unable to ping registry endpoint https://10.10.10.201:5000/v0/
V2 Ping attempt failed with Error:get https://10.10.10.201:5000/v2/: Dial TCP 10.10.10.201:5000:connection refused
V1 Ping attempt failed with error:get https://10.10.10.201:5000/v1/_ping:dial TCP 10.10.10.201:5000:connection refused. HTTP attempt:unable to ping registry endpoint http://10.10.10.201:5000/v0/
V2 Ping attempt failed with Error:get http://10.10.10.201:5000/v2/: Dial TCP 10.10.10.201:5000:connection refused
V1 Ping attempt failed with error:get http://10.10.10.201:5000/v1/_ping:dial TCP 10.10.10.201:5000:connection refused
This is because Docker, from the 1.3.X, interacts with the Docker registry by default with HTTPS, but the private repository built here only provides HTTP services, so when interacting with a private repository there is an error above, and in order to solve this problem you need to start Docker Server when you increase the startup parameter to use HTTP access by default, the workaround is
# Vim/etc/init.d/docker
Change $exec-d $other _args to $exec-d--insecure-registry 10.10.10.201:5000 $other _args
Restarting the Docker service
#/etc/init.d/docker Restart
To start the container:
# Docker Start registry_container_id
View all mirrors in a private warehouse
# Curl Http://10.10.10.201:5000/v1/search
Docker Warehouse Management