docker私有仓库
下载docker仓库镜像registry
[root@localhost opt]# docker pull registry
此时私有仓库地址docker是不信任的,所以先得修改一下对应的配置文件daemon.json
[root@localhost opt]# vim /etc/docker/daemon.json
{
"insecure-registries": ["20.0.0.100:5000"], #添加这一行
"registry-mirrors": ["https://*****.mirror.aliyuncs.com"]
}
[root@localhost opt]# systemctl restart docker.service
创建容器
[root@localhost opt]# docker create -it registry /bin/bash
做仓库需要给端口号和存储空间
此时宿主机自动创建/data/registry,并且挂载容器中的/tmp/registry
[root@localhost opt]# docker run -d -p 5000:5000 -v /data/registry:/tmp/registry registry
下载镜像并打标签
标签需要指向对应的IP和端口
[root@localhost opt]# docker pull nginx
[root@localhost opt]# docker tag nginx:latest 20.0.0.100:5000/nginx-nj
上传镜像
[root@localhost opt]# docker push 20.0.0.100:5000/nginx-nj
docker rmi 20.0.0.100:5000/nginx-nj:latest
docker rmi nginx:latest
查看上传镜像
curl -XGET http://20.0.0.100:5000/v2/_catalog
{"repositories":["nginx-nj"]}
下载镜像仓库的镜像
docker pull 20.0.0.100:5000/nginx-nj