一、私有仓库搭建
1.1、拉取私有仓库镜像
docker pull registry
1.2、启动私有仓库容器
docker run -id --name=registry -p 5000:5000 registry
1.3、验证
curl http://127.0.0.1:5000/v2catalog
1.4、修改daemon.json,用于让docker信任私有仓库地址
vim /etc/docker/daemon.json
新增
"insecure-registries":["私有仓库服务器真实ip:5000"]
1.5、重启docker 服务
systemctl restart docker
1.6、启动私有有仓库
docker start registry
二、将镜像上传至私有仓库
2.1、标记镜像为私有仓库的镜像
docker tag hello_world:1.0 私有仓库服务器IP:5000/hello_world:1.1
2.2、上传标记的镜像
docker push 私有仓库服务器IP:5000/hello_world:1.1
三、 从私有仓库拉取镜像
3.1、拉取镜像
docker pull 私有仓库服务器ip:5000/hello_world:1.1
将本地的hello_world镜像都删掉
拉取镜像
docker pull 127.0.0.1:5000/hello_world:1.1