4、docker仓库操作

一、拉取仓库镜像
->docker pull registry:latest

二、启动仓库镜像
->docker run -d -p 5000:5000 --name registry --restart=always -v /opt/registry-var/:/var/lib/registry/ registry:latest

三、标记镜像
->docker tag [镜像id:tag] 127.0.0.1:5000/test

四、上传到私人仓库
->docker push 127.0.0.1:5000/test

五、常见问题
通常情况下,在上传镜像到仓库这一步的时候会报个错,报错内容如下:
Error response from daemon: invalid registry endpoint https://172.21.28.161:5000/v0/: unable to ping registry endpoint https://172.21.28.161:5000/v0/  
v2 ping attempt failed with error: Get https://172.21.28.161:5000/v2/: tls: oversized record received with length 20527  
 v1 ping attempt failed with error: Get https://172.21.28.161:5000/v1/_ping: tls: oversized record received with length 20527. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 172.21.28.161: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/172.21.28.161:5000/ca.crt  
这是因为在docker1.3以后,默认与仓库访问的协议是https,而刚才使用的是http,所以需要修改配置以支持http方式访问。修改/etc/docker/daemon.js文件,加入"insecure-registries":["10.0.0.92:5000"]属性

 

posted @ 2024-03-20 16:58  陈奕桦  阅读(2)  评论(0编辑  收藏  举报