Docker 本地私有仓库搭建:

Docker 本地私有仓库搭建:

创建数据卷目录:

mkdir /home/sky/registry

用registry镜像启动容器:

docker run -d -p 5000:5000 -v /home/sky/registry:/var/lib/registry --restart=always --name registry registry:2

上传镜像:

docker tag hello-world localhost:5000/hello-world:latest

docker push localhost:5000/hello-world:latest

查询镜像:

curl http://localhost:5000/v2/_catalog

下载镜像:

docker pull localhost:5000/hello-world

验证: 如果删除容器,是否上传的镜像没有丢失。这是因为数据卷起了作用。

 

原文地址:https://www.cnblogs.com/AK47Sonic/p/8743855.html