在Docker容器上使用pip安装时出现EnvironmentError: HTTPSConnectionPool。

3

我刚刚运行了来自https://github.com/puckel/docker-airflow的docker-compose,但由于我需要一个额外的python包,在运行docker exec -it <containerId> bash后尝试手动安装它,但出现以下错误:

图片

Defaulting to user installation because normal site-packages is not writeable
Collecting pymssql
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))': /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/be/09/455835d22f84636dc646f4dc6afcc79c226d8bc253ef767ca8a922eec74a/pymssql-2.1.4-cp37-cp37m-manylinux1_x86_64.whl (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

之前我可以顺利地运行 pip install pymssql,但现在不知道为什么会出问题了,docker-compose.yml 文件和网络都没有做过任何更改。

1个回答

0

我在2020年8月16日遇到了同样的错误。注意到https://files.pythonhosted.org的SSL证书是在8月13日发布的。然后我登录到容器中检查日期,发现日期是8月12日。这就是为什么SSL验证失败的原因。如果你使用的是Windows系统,可以重启Docker桌面来与主机同步时间。但这会导致正在运行的容器停止。如果你不想停止正在运行的容器,那么你需要手动更新Docker容器内部的时间。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接