一、Docker-registry镜像 下载地址

官方镜像下载比较慢,因为人品问题一直下载不成功,所以选择了国内的镜像。

daocloud:   https://hub.daocloud.io/

还有其他国内的一些网站,以后用到再更新。

 

二、下载Docker-registry镜像

 

复制红色框中的地址:

1 docker pull daocloud.io/library/registry:0.5.9

查看镜像下载是否成功

 

 三、开启仓库

1  docker run -d -p 5000:5000 -v /opt/data/registry : /tmp/registry  daocloud.io/library/registry   0.5.9

-d后台运行,-p指定端口,-v 把registry的容器镜像路径 /tmp/registry 映射到本机的 /opt/data/registry

将本地的镜像按照仓库的地址打上标签,准备上传到私有仓库中

1 docker tag hub.c.163.com/library/nginx  192.9.10.14:5000/nginx

上传本地镜像到私有仓库:

1 docker push  192.9.10.14:5000/nginx

 

上传过程中可能会出错:

1 Error: Invalid registry endpoint ... Get ... If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add '--insecure-registry 192.9.10.14:5000' to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/192.168.1.103:5000/ca.crt 

 

 解决方法:

1)网上很多教程都是说修改 sudo vim /etc/default/docker,而centos6.8下并没有该文件,因为 cento 对应配置不在那里 记得应该是这个 /etc/sysconfig/docker,再文件中添加上

ADD_REGISTRY='--add-registry 192.9.10.14:5000',

INSECURE_REGISTRY='--insecure-registry 192.9.10.14:5000'

重启docker :  service docker restart 

然而并不起作用

2)在客户端启动线程

1 docker -d ----insecure-registry 192.9.10.14:5000

该进程不要关,然后再上传镜像,居然可以了。

 

 

Reference:

[1] https://www.cnblogs.com/cloud-it/p/7070198.html 

[2] https://blog.csdn.net/felix_yujing/article/details/51564739