在Mac后面的Docker更改SSL证书的代理

对于下面的问题,我最终的解决方法是说服我们的IT人员不要在dockerhubregistry中间中间人(man-in-the-middle)。 我无法得到任何其他工作,唉。

我遇到了一个问题,我最初尝试让Docker在我的Mac上运行,正在运行10.8.5。 看起来,我公司的证书重写代理似乎正在获取图像的方式:

orflongpmacx8:docker pohl_longsine$ docker run hello-world Unable to find image 'hello-world:latest' locally Pulling repository hello-world FATA[0001] Get https://index.docker.io/v1/repositories/library/hello-world/images: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "bcauth") 

(事实上​​,当我login无线客户端 – 没有媒体代理服务器时 – 我可以通过这个步骤,但是我需要弄清楚如何通过代理服务器进行这项工作,因为使用客户端无线服务器是不可行的长期解决scheme。)

从表面上看,我的问题看起来非常像这个问题的回答 。 然而,在这个问题中接受的答案不适合我,因为他们讨论的root_unix.go文件不会在Mac上被调用。 (从浏览来看,我猜可能会涉及到root_cgo_darwin.go和/或root_darwin.go 。)

这并不能告诉我,在操作上,我需要做一些相当于安装某种可信证书的工作。 我设法把我的手放在一个*.cer文件上,我相信这个文件是我需要的,但是我不知道该如何处理它。

我希望有人能指引我正确的方向。

编辑:我想也许我需要类似于这个网页build议的东西,来添加证书。 唉,我试图遵循这些指示失败的方式如下:

 orflongpmacx8:docker pohl_longsine$ sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "~/Desktop/Certs/redacted.cer" Password: ***Error reading file ~/Desktop/Certs/redacted.cer*** Error reading file ~/Desktop/Certs/redacted.cer 

编辑2:我可能更近一步来解决这个问题。 我应该更好地使用带引号的引号内的path。 如果我使用绝对path,则可以成功运行上述命令来添加证书。

唉,这并没有缓解最终的症状:

 FATA[0001] Get https://index.docker.io/v1/repositories/library/hello-world/images: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "bcauth") 

根据boot2docker自述文件

 Insecure Registry As of Docker version 1.3.1, if your registry doesn't support HTTPS, you must add it as an insecure registry. $ boot2docker init $ boot2docker up $ boot2docker ssh $ echo 'EXTRA_ARGS="--insecure-registry <YOUR INSECURE HOST>"' | sudo tee -a /var/lib/boot2docker/profile $ sudo /etc/init.d/docker restart then you should be able to do a docker push/pull. 

http://golang.org/src/crypto/x509/root_darwin.go的来源显示了这个命令&#xFF1A;

 cmd := exec.Command("/usr/bin/security", "find-certificate", "-a", "-p", "/System/Library/Keychains/SystemRootCertificates.keychain") 

用于查找证书。

尝试将.cer文件添加到OSX证书密钥链中。

如果你使用docker机

编辑$ USER / .docker / machine / machines / default / config.json

 "EngineOptions": { "InsecureRegistry": [ "XXX.XXX.virtual" ], }