一 实战
服务端
[root@localhost opt]# docker run -d -p 5000:5000 -v /opt/docker/registry:/var/lib/registry --restart always --name registry registry:2 Unable to find image 'registry:2' locally 2: Pulling from library/registry 49388a8c9c86: Pull complete e4d43608dd22: Pull complete 3a41740f900c: Pull complete e16ef4b76684: Pull complete 65f212f7c778: Pull complete Digest: sha256:6c891f9a234e44522652261029bd8ae5f7f4b5a0e9fae48986cd3b3fdbecc157 Status: Downloaded newer image for registry:2 f50c2252e2d2be9605083f8b7956817924c778dfb9146cbacf0da319d42b770e [root@localhost opt]# systemctl stop firewalld.service [root@localhost opt]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f50c2252e2d2 registry:2 "/entrypoint.sh /e..." 3 minutes ago Up 3 minutes 0.0.0.0:5000->5000/tcp registry bc87f94ee147 imageb "/bin/bash" 3 days ago Exited (0) 3 days ago test2 7d9c810d02e2 imagea "/bin/bash" 3 days ago Exited (0) 3 days ago test1 [root@localhost opt]# docker exec -it f5 /bin/sh / # cd /var/lib /var/lib # cd registry/ /var/lib/registry # ls docker /var/lib/registry # cd docker/ /var/lib/registry/docker # ls registry /var/lib/registry/docker # cd registry/ /var/lib/registry/docker/registry # ls v2 /var/lib/registry/docker/registry # cd v2 /var/lib/registry/docker/registry/v2 # ls blobs repositories /var/lib/registry/docker/registry/v2 # cd repositories/ /var/lib/registry/docker/registry/v2/repositories # ls vker /var/lib/registry/docker/registry/v2/repositories # cd vker/ /var/lib/registry/docker/registry/v2/repositories/vker # ls box /var/lib/registry/docker/registry/v2/repositories/vker # cd box/ /var/lib/registry/docker/registry/v2/repositories/vker/box # ls _layers _manifests _uploads /var/lib/registry/docker/registry/v2/repositories/vker/box # exit [root@localhost opt]# cd /opt/docker/registry [root@localhost registry]# ls docker [root@localhost registry]# cd docker/ [root@localhost docker]# ls registry [root@localhost docker]# cd registry/ [root@localhost registry]# ls v2 [root@localhost registry]# cd v2/ [root@localhost v2]# ls blobs repositories [root@localhost v2]# cd repositories/ [root@localhost repositories]# ls vker [root@localhost repositories]# cd vker/ [root@localhost vker]# ls box [root@localhost vker]# cd box [root@localhost box]# ls _layers _manifests _uploads[root@localhost opt]#