Skip to content Skip to sidebar Skip to footer

Alpine 3.3, Python 2.7.11, Urllib2 Causing Ssl: Certificate_verify_failed

I have this small Dockerfile FROM alpine:3.3 RUN apk --update add python CMD ['python', '-c', 'import urllib2; response = urllib2.urlopen('https://www.python.org')'] Building it w

Solution 1:

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')"]

Solution 2:

You will need to upgrade Alpine as libssl needs to be upgraded with a patch

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

apk -U upgrade will upgrade these:

  • libcrypto1.0 (1.0.2e-r0 -> 1.0.2g-r0)
  • libssl1.0 (1.0.2e-r0 -> 1.0.2g-r0)

Post a Comment for "Alpine 3.3, Python 2.7.11, Urllib2 Causing Ssl: Certificate_verify_failed"