debian容器化安装python提示ca异常
问题
打包基础镜像,提示ca错误无法校验https协议证书。
1 | RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple |
现象:
SSLErrorCERTIFICATE_VERIFY_FAILEDtlsv1 alert unknown ca
根因:
- 基础镜像过老(尤其是
python:3.x-slim、alpine) - 容器里没有 ca-certificates
解决
1.apt source mirror写http
2.dockerfile add ca-certificates
1 | RUN apt-get update \ |