docker私有仓库创建,忽略https认证
部署镜像仓库Docker Registry | Docker Documentation## 使用docker镜像启动镜像仓库服务$ docker run -d -p 5000:5000 --restart always --name registry registry:2## 默认仓库不带认证,若需要认证,参考https://docs.docker.com/registry/deploying/
·
-
部署镜像仓库
Docker Registry | Docker Documentation
## 使用docker镜像启动镜像仓库服务 $ docker run -d -p 5000:5000 --restart always --name registry registry:2 ## 默认仓库不带认证,若需要认证,参考https://docs.docker.com/registry/deploying/#restricting-access
-
推送本地镜像到镜像仓库中
$ docker tag nginx:alpine localhost:5000/nginx:alpine $ docker push localhost:5000/nginx:alpine ## 查看仓库内元数据 $ curl -X GET http://172.21.51.143:5000/v2/_catalog $ curl -X GET http://172.21.51.143:5000/v2/nginx/tags/list ## 镜像仓库给外部访问,不能通过localhost,尝试使用内网地址172.21.51.143:5000/nginx:alpine $ docker tag nginx:alpine 172.21.51.143:5000/nginx:alpine $ docker push 172.21.51.143:5000/nginx:alpine The push refers to repository [172.21.51.143:5000/nginx] Get https://172.21.51.143:5000/v2/: http: server gave HTTP response to HTTPS client ## docker默认不允许向http的仓库地址推送,如何做成https的,参考:https://docs.docker.com/registry/deploying/#run-an-externally-accessible-registry ## 我们没有可信证书机构颁发的证书和域名,自签名证书需要在每个节点中拷贝证书文件,比较麻烦,因此我们通过配置daemon的方式,来跳过证书的验证: $ cat /etc/docker/daemon.json { "registry-mirrors": [ "https://8xpk5wnt.mirror.aliyuncs.com" ], "insecure-registries": [ "172.21.51.143:5000" ] } $ systemctl restart docker $ docker push 172.21.51.143:5000/nginx:alpine
更多推荐
已为社区贡献1条内容
所有评论(0)