大家好,又见面了,我是你们的朋友全栈君。
1、创建私有仓库
docker pull registry
docker run -d -v /opt/registory:/var/lib/registory -p 5000:5000 --restart=always --name registry registry
2、查看私有仓库
curl http://47.99.211.128:5000/v2/_catalog
# 域名解析后
curl http://hub.chenhailong.online/v2/_catalog
{"repositories":[]}
3、 将制作的镜像推到私有仓库
# 参考docker hub官网
docker push chenhailong666/test:tagname
[root@iZbp1hun1qsl59e2nzqyvcZ ~]# docker push 47.99.211.128:5000/test:1.0
The push refers to repository [47.99.211.128:5000/test]
Get https://47.99.211.128:5000/v2/: http: server gave HTTP response to HTTPS client
[root@iZbp1hun1qsl59e2nzqyvcZ ~]# curl http://47.99.211.128:5000/v2/_catalog
{"repositories":[]}
[root@iZbp1hun1qsl59e2nzqyvcZ ~]#
vi /etc/docker/daemon.json
# daemon.json
# 加入解析后的域名
{"insecure-registries":["47.99.211.128:5000","hub.chenhailong.online"]}
service docker restart
docker image ls
# ----------查看
REPOSITORY TAG IMAGE ID CREATED SIZE
47.99.211.128:5000/test 1.0 b733ed3d34c8 3 days ago 675MB
chenhailong666/test 1.0 b733ed3d34c8 3 days ago 675MB
jenkinsci/blueocean latest 7959e11c0266 6 days ago 555MB
nginx latest 2bcb04bdb83f 4 weeks ago 109MB
registry latest f32a97de94e1 7 weeks ago 25.8MB
mysql 5.6 96e41ac53eac 2 months ago 256MB
jenkins latest cd14cecfdb3a 9 months ago 696MB
maven 3-alpine 5435658a63ac 21 months ago 116MB
hub.c.163.com/wuxukun/maven-aliyun 3-jdk-8 676639454cb4 2 years ago 653MB
docker push 47.99.211.128:5000/test:1.0
docker run --name=nginx -p 80:80 -v /app/nginx/www:/usr/share/nginx/html -v /app/nginx/conf.d:/etc/nginx/conf.d -d --restart=always nginx
参考: 博文
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/143118.html原文链接:https://javaforall.cn