CoreOS环境下通过register镜像搭建私有仓库(2)

root@gerryyang:~# docker push 104.131.173.242:5000/Ubuntu_sshd_gcc_gerry:14.04 
FATA[0002] Error: Invalid registry endpoint https://104.131.173.242:5000/v1/: Get https://104.131.173.242:5000/v1/_ping: EOF. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 104.131.173.242: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/104.131.173.242:5000/ca.crt 
解决方法:

解决方案:

vi /usr/lib/systemd/system/docker.service

内容修改如下:

[Unit] 
        Description=Docker Application Container Engine 
        Documentation=http://docs.docker.com 
        After=network.target docker.socket 
        Requires=docker.socket 
         
        [Service] 
        Type=notify 
        EnvironmentFile=-/etc/sysconfig/docker 
        EnvironmentFile=-/etc/sysconfig/docker-storage 
        ExecStart=/usr/bin/docker -d --insecure-registry 10.0.0.142:5000  -H fd:// $OPTIONS $DOCKER_STORAGE_OPTIONS 
        LimitNOFILE=1048576 
        LimitNPROC=1048576 
         
        [Install] 
        WantedBy=multi-user.target 

在CoreOS系统中,执行方法一,可能会遇到/usr/lib/systemd/system/docker.service 文件ReadOnly 无法修改的情况,这时可以手工启动并添加 --insecure-registry参数
localhost ~ # /usr/lib/coreos/dockerd --daemon --insecure-registry 10.0.0.142:5000 

3 私有仓库查询方法
curl :5000/v1/search
说明:使用curl查看仓库104.131.173.242:5000中的镜像。在结果中可以查看到ubuntu_sshd_gcc_gerry,说明已经上传成功了。

4 在其他的机器上访问和下载私有仓库的镜像
在客户机上手工启动docker:localhost ~ # /usr/lib/coreos/dockerd --daemon --insecure-registry 10.0.0.142:5000 
执行pull命令
localhost ~ # docker pull 10.0.0.142:5000/jdk7
Pulling repository 10.0.0.142:5000/jdk7
134625e9d4d7: Download complete
134625e9d4d7: Pulling image (latest) from 10.0.0.142:5000/jdk7
6941bfcbbfca: Download complete
41459f052977: Download complete
fd44297e2ddb: Download complete
40eba1bcf993: Download complete
e60bdcf6f45f: Download complete
367c013cf9ca: Download complete
81812b96beec: Download complete
776f6d47bdf7: Download complete
2c96f979a63a: Download complete
f33b1fffe108: Download complete
71f589de03a8: Download complete
2115aa302043: Download complete
6a498e83fe1b: Download complete
591be66f0e03: Download complete
c468a9de6202: Download complete
a510d6919954: Download complete
14b73f7c3942: Download complete
b591b7e6f5da: Download complete
f1a90a0630e1: Download complete
131a069bbe25: Download complete
Status: Downloaded newer image for 10.0.0.142:5000/jdk7:latest

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/16275.html