SSL:docker 容器中的 CERTIFICATE_VERIFY_FAILED 错误

cid*_*cid 5 python ssl easy-install pip docker

我在执行 easy_install pip 时遇到以下错误消息:

root@ff45b7b74944:/# easy_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading [--https link here, like above--]
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
Run Code Online (Sandbox Code Playgroud)

这是在 ubuntu:latest 上运行的 docker 容器中运行的。我倾向于这样一个事实,即它不能做 openssl 的东西(https 链接),但我并不完全确定。如果有人有解决方案或任何故障排除方法,我很想知道。

谢谢。

Mat*_*att 6

添加RUN apt-get install ca-certificates到我的 Dockerfile 对我有用。


cid*_*cid 0

解决了:

在 Dockerfile 中添加了以下内容:

RUN mkdir /etc/pki
RUN mkdir /etc/pki/tls
RUN mkdir /etc/pki/tls/certs
RUN apt-get install wget
RUN wget http://curl.haxx.se/ca/cacert.pem
RUN mv cacert.pem ca-bundle.crt
RUN mv ca-bundle.crt /etc/pki/tls/certs
Run Code Online (Sandbox Code Playgroud)