Articles Catalogue
The main purpose of establishing private warehouse is to use it by oneself or company, download it quickly, and do not need to download it abroad. convenient
Articles Catalogue
Warehouse Mirror Docker hub has officially provided a container mirror registry for building private warehouses # docker imagers # Check out what mirrors you have
1. Pull the mirror:
# docker pull daocloud.io/library/registry:latest
2. Operating containers:
# docker run --name "pri_registry" -- restart = always-d-p 5000:5000 daocloud.io/library/registry//restart = always: boot-up is self-starting, and service reboot will follow. Mapping to the host's 5000 port, and its own 5000 port-d is used in the background. #docker ps #Take a look at the startup status //Note: If the creation of containers is unsuccessful, the error firewall is reported. The solution is as follows. #systemctl stop firewalld #yum install iptaqbles* #systemctl start iptables #iptables -F #systemctl restart docker # docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1f444285bed8 daocloud.io/library/registry "/entrypoint.sh /etc/" 23 seconds ago Up 21 seconds 0.0.0.0:5000->5000/tcp elegant_rosalind
3. Connect the container to view port status:
# Docker exec-it 1f444285bed8/bin/sh//Here is sh, not bash /# Netstat-lnp//Check whether the 5000 port is open Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 :::5000 :::* LISTEN 1/registry Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path #ctrl+q+p exits the edit page, but does not exit the container
4. Check whether the private warehouse can be accessed locally to see if the status code is 200.
[root@master registry]# Curl-i 127.0.0.1:5000// parameter is capitalized i HTTP/1.1 200 OK
For convenience, download a smaller image, buysbox
# docker pull busybox
Before uploading, the image must be tag ged with ip and port:
# docker tag busybox native IP: port/busybox
This is a mirror drawn directly from the official, very slow:
# docker tag busybox 192.168.245.136:5000/busybox
The following Mysql is the second image I tested, pulled from daocloud:
# docker tag daocloud.io/library/mysql 192.168.245.136:5000/daocloud.io/library/mysql Note: You can use mirror name or id after tag. I use mirror name here. If you use official image, you don't need prefix, but daocloud.io's Prefix
The following error reporting problems are inevitable:
Modify the request to http: The default is https, and the following errors will not be reported. Get https://master.up.com:5000/v1/_ping: http: server gave HTTP response to HTTPS client # vim /etc/docker/daemon.json { "insecure-registries":["192.168.245.136:5000"] }
Restart docker:
# systemctl restart docker
Upload mirror to private warehouse:
# docker push 192.168.245.136:5000/busybox #Push it to a private warehouse # docker push 192.168.245.136:5000/daocloud.io/library/mysql
Look at all the mirrors in the private warehouse:
Note that I'm using the example of ubuntu here.
# curl 192.168.245.130:5000/v2/_catalog {"repositories":["daocloud.io/ubuntu"]} //Or: # curl http://192.168.245.130:5000/v2/daocloud.io/ubuntu/tags/list {"name":"daocloud.io/ubuntu","tags":["v2"]} //Mirror testing can be pulled out: #docker pull 192.168.245.136:5000/busybox