私人dockerregistry不能连接到壳牌和Webpipe理界面?

背景:

要在Docker for Windows安装的Windows 10(x64)系统上的localhost上的pathc:\ dkrreg上设置私有 docker registry服务器 ,请尝试以下命令:

docker run --detach --publish 1005:5000 --name docker-registry --volume /c/dkrreg:/var/lib/registry registry:2 docker pull hello-world:latest docker tag hello-world:latest localhost:1005/hello-world:latest docker push localhost:1005/hello-world:latest docker pull localhost:1005/hello-world:latest 

localhost:1005/hello-world:latest通过命令行的localhost:1005/hello-world:latest推送成功。

问题:

如果我通过docker pull 192.168.43.239:1005/hello-world:latest使用我的IP地址,它会在命令行docker pull 192.168.43.239:1005/hello-world:latest给出以下错误:

 Error response from daemon: Get https://192.168.43.239:1005/v1/_ping: http: server gave HTTP response to HTTPS client 

当通过docker run --detach portainer:latest使用第三方dockerUIpipe理器docker run --detach portainer:latest它也显示错误连接为:

 2017/04/19 14:30:24 http: proxy error: dial tcp [::1]:1005: getsockopt: connection refused 

也试过其他的东西。 如何使用任何Dockerpipe理UI工具连接从局域网的localhost:1005私有注册服务器?

最后find解决这个棘手的问题

  1. 生成CA私钥和证书,如ca-cert-mycompany.pemca-cert-key-companyname.pem 。 并configurationdocker-compose.yml将这两个文件保存为:ro在以下位置: /usr/local/share/ca-certificates/etc/ssl/certs/ /etc/docker/certs.d/mysite.com 。 但是我也试过只复制证书到/usr/local/share/ca-certificates就足够了,因为docker会忽略重复的CA证书。 这额外的复制是因为在许多放置docker的人build议相同。 我没有执行命令: update-ca-certificates这次是在registry容器中,但是更早的做法是针对许多人提出的build议。

  2. docker-compose.yml中定义:随机数为REGISTRY_HTTP_SECRET ,服务器的链接证书CA证书附加到它的结尾REGISTRY_HTTP_TLS_CERTIFICATE和服务器的公钥REGISTRY_HTTP_TLS_KEY 。 已禁用HTTP身份validation。 特别是使用一些命名文件名与其他证书在容器文件夹中findmysite.com_server-chained-certificate.crt而不是仅仅certificate.crt

  3. V-Imp:使用命令certutil.exe -addstore root .\Keys\ca-certificate.crt将证书推送到Windows中受信任的根目录,然后从任务栏图标重新启动Docker for Windows ,然后使用docker-compose up -d创build容器。 这是没有任何工作的最重要的一步。

现在可以执行docker pull mysite.com:1005/my-repo:my-tag

您需要指定您的Docker守护进程您的registry是不安全的: https : //docs.docker.com/registry/insecure/

根据您的OS /系统,您需要更改守护程序的configuration以指定registry地址(格式IP:PORT ,使用192.168.43.239:1005而不是localhost:1005 )。

一旦你完成了,你应该能够执行以下操作:

docker pull 192.168.43.239:1005/hello-world:latest

你也应该能够通过Portainer在registry字段中使用192.168.43.239:1005来访问它。

如果你想在Portainer内部使用localhost:1005访问你的registry,你可以尝试在hostnetworking中运行它。

docker run --detach --net host portainer:latest