Docker:私有仓库操作
2019-06-20 本文已影响0人
wxb2dyj
私有仓库在主机A上(局域网IP:10.10.2.141,端口:5000),欲将局域网内的主机B上的镜像上传
1、从Docker Hub上拉去镜像IMAGE,标签为latest;
docker pull IMAGE
例如,docker pull hello-world
2、在本地部署镜像IMAGE,进行操作(更新),然后希望保存到局域网内的私有仓库:
(1)给更新后的镜像IMAGE打标签
docker tag IMAGE:latest 私有仓库IP:PORT/新的镜像名称:标签
例如,docker tag hello-world:latest 10.10.2.141:5000/hello-world:20190620
(2)上传到私有仓库
docker push 私有仓库IP:PORT/新的镜像名称:标签
例如,docker push 10.10.2.141:5000/hello-world:20190620
(3)查看仓库中的镜像
curl 私有仓库IP:PORT/v2/_catalog
例如,curl 10.10.2.141:5000/v2_catalog,返回如下:
{"repositories":[hello-world"]}
(4)从局域网内的其他主机中拉取该镜像
docker pull 私有仓库IP:PORT/新的镜像名称:标签
docker pull 10.10.2.141:5000/hello-world:20190620