windows 如何忽略 Boot2Docker 中的证书错误
How to ignore certificate errors in Boot2Docker on windows
我通过 virtualbox 在 windows 上安装了 boot2docker 1.4.1 运行ning。我支持 MITMs https 证书的代理。我通过在 /var/lib/boot2docker/profile
:
中添加以下行来配置代理
export HTTP_PROXY=<proxyhost>:80
export HTTPS_PROXY=<proxyhost>:80
DOCKER_TLS=no
EXTRA_ARGS="--insecure-registry index.docker.io"
但是当我 运行 docker@boot2docker:~$ docker run hello-world
我得到
Unable to find image 'hello-world:latest' locally
Pulling repository hello-world
FATA[0006] Get https://index.docker.io/v1/repositories/library/hello-world/images
: x509: certificate signed by unknown authority
请帮我找出忽略证书错误的正确方法。谢谢!
编辑 看起来新的 docker 只适用于 certain flavors of Windows 10. If you are still stuck on Windows 7, I have updated the below to reflect the steps I had to go through to correct the 'self signed certificate in certificate chain' error when I installed the latest version of docker-toolbox (Docker 1.11.2).
终于按照这里的答案在 Windows 7 上运行了:
https://github.com/boot2docker/boot2docker/issues/347
通过 运行 openssl s_client -showcerts:
检查这是否是您的问题
docker@boot2docker:~$ openssl s_client -showcerts -CApath . -connect index.docker.io:443
(编辑:从 -showcerts 中删除了 32 并更正了主机名)
在证书链中,您会看到代理已插入自身并验证 returns 类似这样的错误
Verify return code: 19 (self signed certificate in certificate chain)
如果您遇到同样的问题,请尝试以下步骤:
- 首先,保存您需要的证书。以下是在 Firefox 中使用类似于 的步骤(Chrome 并且 IE 也应该使用证书导出向导工作;注意:在 Windows 上,PEM 证书编码称为 Base-64编码的 X.509 (.CER)):
- 在 Firefox 中,转到 https://hub.docker.com/
- 单击地址栏上的锁图标以显示证书
- 点击 "More Information" -> "Security" -> "View Certificate" --> "Details"
- Select 层次结构中的每个节点从最上面的节点开始,然后单击 "Export" 和 "Save"(select X.509 证书 (PEM) 格式)
- 将上述文件保存在本地驱动器的某个位置,将扩展名更改为 .pem 并将它们移动到您的用户文件夹(或可从 ssh 访问的任何其他位置)
- 创建一个文件夹来保存证书:
docker@boot2docker:~$ sudo mkdir /var/lib/boot2docker/certs/
- 将证书文件复制到该位置:
docker@boot2docker:~$ sudo cp /c/Users/<username>/<folder>/<proxy-cert>.pem /var/lib/boot2docker/certs/
- 创建文件
/var/lib/boot2docker/bootlocal.sh
并包含来自 https://gist.github.com/irgeek/afb2e05775fff532f960 的源代码(我刚刚使用 Notepad++ 在 Windows 中创建了文件并将其复制到与上述步骤类似的正确位置)
- 退出 ssh 并重新启动:
C:\>docker-machine restart
- 打开 shell
docker-machine ssh
并验证更改是否有效:docker run hello-world
您应该会看到包含以下内容的输出:
Hello from Docker.
This message shows that your installation appears to be working correctly.
如果您在 Windows 10 上有 Docker 的 Windows,并且您'重新收到 "x509: certificate signed by unknown authority" 错误,您可以试试这个:
- 运行 Docker 对于 Windows.
- 一段时间后,您会在 Windows 通知区域(右下角)看到 docker 图标
- 右击图标 select "Settings..."
- 设置 window 将打开。 Select "Docker Daemon" 在左边。
- 将您的私有注册表添加到以 JSON 格式显示配置的文本框中的 "insecure-registries" 集合。然后点击"Apply"。
我通过 virtualbox 在 windows 上安装了 boot2docker 1.4.1 运行ning。我支持 MITMs https 证书的代理。我通过在 /var/lib/boot2docker/profile
:
export HTTP_PROXY=<proxyhost>:80
export HTTPS_PROXY=<proxyhost>:80
DOCKER_TLS=no
EXTRA_ARGS="--insecure-registry index.docker.io"
但是当我 运行 docker@boot2docker:~$ docker run hello-world
我得到
Unable to find image 'hello-world:latest' locally
Pulling repository hello-world
FATA[0006] Get https://index.docker.io/v1/repositories/library/hello-world/images
: x509: certificate signed by unknown authority
请帮我找出忽略证书错误的正确方法。谢谢!
编辑 看起来新的 docker 只适用于 certain flavors of Windows 10. If you are still stuck on Windows 7, I have updated the below to reflect the steps I had to go through to correct the 'self signed certificate in certificate chain' error when I installed the latest version of docker-toolbox (Docker 1.11.2).
终于按照这里的答案在 Windows 7 上运行了: https://github.com/boot2docker/boot2docker/issues/347
通过 运行 openssl s_client -showcerts:
检查这是否是您的问题docker@boot2docker:~$ openssl s_client -showcerts -CApath . -connect index.docker.io:443
(编辑:从 -showcerts 中删除了 32 并更正了主机名)
在证书链中,您会看到代理已插入自身并验证 returns 类似这样的错误
Verify return code: 19 (self signed certificate in certificate chain)
如果您遇到同样的问题,请尝试以下步骤:
- 首先,保存您需要的证书。以下是在 Firefox 中使用类似于 的步骤(Chrome 并且 IE 也应该使用证书导出向导工作;注意:在 Windows 上,PEM 证书编码称为 Base-64编码的 X.509 (.CER)):
- 在 Firefox 中,转到 https://hub.docker.com/
- 单击地址栏上的锁图标以显示证书
- 点击 "More Information" -> "Security" -> "View Certificate" --> "Details"
- Select 层次结构中的每个节点从最上面的节点开始,然后单击 "Export" 和 "Save"(select X.509 证书 (PEM) 格式)
- 将上述文件保存在本地驱动器的某个位置,将扩展名更改为 .pem 并将它们移动到您的用户文件夹(或可从 ssh 访问的任何其他位置)
- 创建一个文件夹来保存证书:
docker@boot2docker:~$ sudo mkdir /var/lib/boot2docker/certs/
- 将证书文件复制到该位置:
docker@boot2docker:~$ sudo cp /c/Users/<username>/<folder>/<proxy-cert>.pem /var/lib/boot2docker/certs/
- 创建文件
/var/lib/boot2docker/bootlocal.sh
并包含来自 https://gist.github.com/irgeek/afb2e05775fff532f960 的源代码(我刚刚使用 Notepad++ 在 Windows 中创建了文件并将其复制到与上述步骤类似的正确位置) - 退出 ssh 并重新启动:
C:\>docker-machine restart
- 打开 shell
docker-machine ssh
并验证更改是否有效:docker run hello-world
您应该会看到包含以下内容的输出:
Hello from Docker.
This message shows that your installation appears to be working correctly.
如果您在 Windows 10 上有 Docker 的 Windows,并且您'重新收到 "x509: certificate signed by unknown authority" 错误,您可以试试这个:
- 运行 Docker 对于 Windows.
- 一段时间后,您会在 Windows 通知区域(右下角)看到 docker 图标
- 右击图标 select "Settings..."
- 设置 window 将打开。 Select "Docker Daemon" 在左边。
- 将您的私有注册表添加到以 JSON 格式显示配置的文本框中的 "insecure-registries" 集合。然后点击"Apply"。