dockers-系统学习-私有仓库搭建
一、私有仓库搭建
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/v2/_catalog
1.4、修改daemon.json,用于让docker信任私有仓库地址
vim /etc/docker/daemon.json
新增
"insecure-registries":["私有仓库服务器真实ip:5000"]
例如:"insecure-registries":["192.168.2.103:5000"]
1.5、重启docker 服务
systemctl restart docker
1.6、启动私有有仓库
docker start registry
二、将镜像上传至私有仓库
2.1、标记镜像为私有仓库的镜像
docker tag helloworld:1.1 私有仓库服务器IP:5000/helloworld:1.2
例如:
docker tag helloworld:1.1 192.168.2.103:5000/helloworld:1.2
2.2、上传标记的镜像
docker push 私有仓库服务器IP:5000/helloworld:1.2
例如:
docker push 192.168.2.103:5000/helloworld:1.2
2.3、验证
curl http://127.0.0.1:5000/v2/_catalog
三、 从私有仓库拉取镜像
3.1、拉取镜像
docker pull 私有仓库服务器ip:5000/helloworld:1.1
- 将本地的helloworld镜像都删掉
-
拉取镜像
docker pull 192.168.2.103:5000/helloworld:1.2