Warehouse building

#Download the Registry image and start it
$ docker pull registry
Using default tag: latest
latest: Pulling from library/registry
0a6724ff3fcd: Pull complete 
d550a247d74f: Pull complete 
1a938458ca36: Pull complete 
acd758c36fc9: Pull complete 
9af6d68b484a: Pull complete 
Digest: sha256:d5459fcb27aecc752520df4b492b08358a1912fcdfa454f7d2101d4b09991daa
Status: Downloaded newer image for registry:latest
docker.io/library/registry:latest

#Run Registry 
$ docker run -d -v /edc/images/registry:/var/lib/registry -p 5000:5000 --restart=always --name xdp-registry registry

#View all the mirror curl in the mirror repository http://ip:port/v2/_catalog
$ curl "172.22.19.46:5000 / v2 / _catalog"
{"repositories":[]}


#Running HTTP access
$ vim /etc/docker/daemon.json

#Plus the following sentence, right here"your-server-ip"Please change to your server's extranet IP address:{"insecure-registries" : ["172.22.19.46:5000"]}
#Restart the docker
$ systemctl restart docker
Copy the code

Upload the image

#Look at mirror
$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE leaf latest 2e0e5c2b0d50 2 days ago 682MB usercenter latest 935002439689 2 days ago  721MB java 8 d23bdf5b1b1b 4 years ago 643MB
#Tag Indicates the tag of the image to be uploaded 
$ docker tag leaf:test172.22.19.46:5000 / leaf:test

#Then check the mirror, local many tagged mirror
$ docker images
REPOSITORY               TAG       IMAGE ID       CREATED       SIZE
172.22.19.46:5000/leaf   test      2e0e5c2b0d50   2 days ago    682MB
leaf                     latest    2e0e5c2b0d50   2 days ago    682MB
usercenter               latest    935002439689   2 days ago    721MB
java                     8         d23bdf5b1b1b   4 years ago   643MB

#Upload image leaf:testGo to mirror warehouse
$Docker push 172.22.19.46:5000 / leaf:test

#View all mirrors in the mirror warehouse. They have been uploaded to the mirror warehouse
$ curl "172.22.19.46:5000 / v2 / _catalog"
{"repositories":["leaf"]}
Copy the code

Download mirror

#Switch to a computer without a Leaf:testDocker server
$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE leaf latest c2667ad17cb1 2 days ago 682MB usercenter latest 6b31f9fa9e1d 3 days ago  721MB java 8 d23bdf5b1b1b 4 years ago 643MB
#Pull the mirror
$Docker pull 172.22.19.46:5000 / leaf:testtest: Pulling from leaf 7448db3b31eb: Pull complete c36604fa7939: Pull complete 29e8ef0e3340: Pull complete a0c934d2565d: Pull complete a360a17c9cab: Pull complete cfcc996af805: Pull complete 2cf014724202: Pull complete 4bc402a00dfe: Pull complete 34bba5de40ce: Pull complete 6896fed66014: Pull complete Digest: sha256:d012631f35039c381973871b7cd263cfdfd0ff10801f0360b1ce3196f638389c Status: Downloaded newer image for 172.22.19.46:5000 / leaf: test 172.22.19.46:5000 / leaf: test

#The image is downloaded successfully
$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE leaf latest C2667AD17CB1 2 days ago 682MB 172.22.19.46:5000/ Leaf test 2e0e5C2b0d50 2 days ago 682MB usercenter latest 6b31f9fa9e1d 3 days ago 721MB java 8 d23bdf5b1b1b 4 years ago 643MBCopy the code