docker-搭建docker镜像私服
一、本地搭建
1、拉取registry
docker pull registry

2、运行容器
docker run -d -p 5000:5000 --restart=always --name registry -v /opt/registry:/var/lib/registry registry

访问http://localhost:5000/v2/_catalog

3、上传镜像
①查看已有镜像
docker images

②给要上传的镜像打标签
docker tag ocelotgatewaydemo_a:latest 192.168.192.139:5000/ocelotgatewaydemo_a:t1
③推送镜像
添加docker配置文件daemon.json文件,配置本地服务地址,保存到服务器的/etc/docker/目录下。
{
"insecure-registries" : [ "192.168.192.139:5000" ]
}

docker push 192.168.192.139:5000/ocelotgatewaydemo_a:t1

浏览:http://192.168.192.139:5000/v2/_catalog

④拉取镜像
先删除本地镜像
docker rmi 192.168.192.139:5000/ocelotgatewaydemo_a:t1 docker pull 192.168.192.139:5000/ocelotgatewaydemo_a:t1

另外程序员都喜欢用Git,如果把Registry私有仓库比作GitLab的话,那么Docker Hub公共仓库就类似于GitHub,这是一个公共的共享的镜像仓库平台,我们可以像在GitHub上随意得clone公共的开源项目一样pull镜像到本地。
鸣谢:
https://www.cnblogs.com/roluodev/p/12251479.html
https://www.runoob.com/docker/docker-container-connection.html
https://www.bianchengquan.com/article/606449.html
本文来自博客园,作者:{春光牛牛,yak},转载请注明原文链接:https://www.cnblogs.com/yakniu/p/16330039.html
欢迎各位大佬们评论指正
QQ讨论群:610129902


浙公网安备 33010602011771号