Hub IP:10.0.2.6 操作系统:CentOS 7 64位 Docker版本:1.12.5
Client IP:10.0.2.4 操作系统:CentOS 7 64位 Docker版本:1.12.5
在Hub端
vim /etc/sysconfig/docker
修改该文件的 OPTIONS='--selinux-enabled --insecure-registry 10.0.2.6:5000'
systemctl restart docker #重启docker服务
docker pull docker.io/registry:latest
docker pull docker.io/nginx:latest
mkdir -p /opt/data/registry
docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registry --name registry registry:latest
docker tag docker.io/nginx:latest 10.0.2.6:5000/nginx
docker push 10.0.2.6:5000/nginx
验证:curl 10.0.2.6:5000/v2/_catalog
显示结果: {"repositories":["nginx"]}
在Client端
vim /etc/sysconfig/docker
修改OPTIONS='--insecure-registry 10.0.2.6:5000'
添加ADD_REGISTRY='--add-registry 10.0.2.6:5000'
systemctl restart docker #重启docker服务
从Hub中拉取nginx镜像:docker pull nginx