![SSL:docker 容器中的 CERTIFICATE_VERIFY_FAILED 错误](https://linux22.com/image/1500053/SSL%EF%BC%9Adocker%20%E5%AE%B9%E5%99%A8%E4%B8%AD%E7%9A%84%20CERTIFICATE_VERIFY_FAILED%20%E9%94%99%E8%AF%AF.png)
当我执行 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')
这是在 ubuntu:latest 上运行的 docker 容器中运行的。我倾向于认为它不能执行 openssl 操作(https 链接),但我并不完全确定。如果有人有解决方案或任何故障排除方法,我很想了解一下。
谢谢。
答案1
添加RUN apt-get install ca-certificates
到我的Dockerfile 对我有用。
答案2
解决了:
在 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
答案3
全新安装以下软件包解决了我的问题
apt-get -yqq install build-essential libssl-dev libffi-dev python3-pip python3-dev gnupg