Up until about a week ago I was successfully using python 3.6 scripts on a java image like this:
FROM openjdk:7-jre-alpine
RUN apk update \
&& apk upgrade \
&& apk add --no-cache bash \
&& apk add --no-cache --virtual=build-dependencies unzip \
&& apk add --no-cache curl \
&& apk add --no-cache go
RUN apk add --no-cache python3 && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools && \
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3
/usr/bin/python; fi && \
rm -r /root/.cache && \
pip install kubernetes
now this dockerfile fails at the line
&& apk add --no-cache bash \
And the only solution I found was to comment out the build dependancies and bring them thus:
&& echo -e "http://nl.alpinelinux.org/alpine/v3.5/main\nhttp://nl.alpinelinux.org/alpine/v3.5/community" > /etc/apk/repositories \
&& apk add --no-cache bash \
#&& apk add --no-cache --virtual=build-dependencies unzip \
This fix installs python version 3.52 instead of 3.6
How do I install python 3.6 [or any version I want] on openjdk:7-jre-alpine docker?
Update: Now all the alpine options are failing
This Dockerfile seems to install python 3.6.5 on top of the openjdk image.
I copy-pasted the python 3.6 alpine image from here but had to remove lines 33-34 as they were broken. Take that into account if you're gonna use that in production. Happy pythoning.
After spending a few hours trying many different options including reinstalling docker in more than one version. I managed to get the Dockefile below to work. Note that I had to repeat the build a few times. My theory is that my WIFI or network or VPN were causing timeouts. After a successful build on my mac's local docker repo I attempted the same on minikube with virtualbox vm and it worked after repeating the same build a few times and noticing the errors happened further along the script.
Here is the Dockerfile for what it's worth: