docker自定义镜像仓库
创建私有仓库
vim /etc/docker/daemon.json
//使用私有仓库运行容器 , 宿主机ip
{ "insecure-registries" : ["192.168.1.20:5000"] }
[root@docker01 ~]# systemctl restart docker [root@docker01 ~]# docker run -itd -p 5000:5000 registry:latest [root@docker01 ~]# curl http://192.168.1.21:5000/v2/
打标记上传
[root@docker01 ~]# docker tag myos:latest 192.168.1.21:5000/myos:latest [root@docker01 ~]# docker push 192.168.1.21:5000/myos:latest
客户端
配置 daemon.json
重启 docker服务
启动运行容器
docker run -it 192.168.1.21:5000/myos:latest /bin/bash
curl http://192.168.1.21:5000/v2/_catalog # 查看镜像 curl http://192.168.1.21:5000/v2/<repo>/tags/list # 查看镜像标签
docker run -d -p 80:80 -v /mnt/qq:/var/www/html -it myos:http 224248f0df5d795457c43c2a7dad0b7e5ec86abdc3f31d577e72f7929f020e01
[root@docker2 ~]# docker run -d -p 80:80 -v /mnt/qq:/var/www/html -it 192.168.1.10:5000/myos:http
00346dabec2c7a12958da4b7fee6551020249cdcb111ad6a1058352d2838742a