Alpine 3.3, Python 2.7.11, urllib2 causing SSL: CERTIFICATE_VERIFY_FAILED

前端 未结 2 1703
感动是毒
感动是毒 2021-01-17 14:10

I have this small Dockerfile

FROM alpine:3.3
RUN apk --update add python
CMD [\"python\", \"-c\", \"import urllib2; response = urllib2.urlopen(\'https://www.         


        
2条回答
  •  死守一世寂寞
    2021-01-17 14:14

    You need to install ca-certificates to be able to validate signed certs by public CAs:

    FROM alpine:3.3
    RUN apk --no-cache add python ca-certificates
    CMD ["python", "-c", "import urllib2; response = urllib2.urlopen('https://www.python.org')"]
    

提交回复
热议问题