rancher2+docker+SpringCloud+jenkins+redis集群+mysql主从搭建:四、安装私有镜像仓库 (通过rancher部署服务)
创建docker私有仓库:这里测试为了简洁采用了registry仓库,线上环境建议采用harbor
docker pull registry
因为docker从1.3.x之后,与docker registry交互使用默认的https,
然而此处搭建的私有仓库只提供http服务,所以当与私有仓库交互时就会报错,
"registry-mirrors": {"https://registry.docker-cn.com"},
insecure-registries:是为解决https的问题所以配置
138 和 139:
vim /etc/docker/daemon.json
{
"registry-mirrors":["http://86d2a50b.m.dacloud.io"],
"insecure-registries":["192.168.109.137:5000"]
}
systemctl restart docker
137:
mkdir -pv /water/runfile/docker_volume/registry
到rancher部署 registry 容器:
服务名: registry
镜像名: registry:latest
端口:5000
映射路径:/water/runfile/docker_volume/registry:/var/lib/registry
实际运行的命令如下:
docker run -d -p 5000:5000 --name=dockerregistry --privileged=ture \
-v /water/runfile/docker_volume/registry:/var/lib/registry \
registry
查看私有仓库所有的镜像:curl -XGET http://192.168.109.137:5000/v2/_catalog
curl -XGET http://192.168.109.137:5000/v2/镜像名/tags/list
如(curl -XGET http://192.168.109.137:5000/v2/redis/tags/list)