I am trying to figure out a way that I can install both python2.7 and 3.7 in a lightweight alpine docker image.
Currently I am using the
FROM python:3.7-alpine3.9
Base image but would like to know how to get python2 installed as well.
Read the concise, action-oriented Python on Docker Production Handbook. As promised, Alpine images build faster and are smaller: 15 seconds instead of 30 seconds, and the image is 105MB instead of 150MB. That's pretty good!
System packages The “official” Docker python image is based off Debian 11, so it has access to the same set of up-to-date packages. RHEL 8 does backport newer versions of applications, however, for example Python 3.9 support.
Use something like:
RUN apk add --no-cache python2
This will install the latest version of Python 2 as python2
or python2.7
. Python 3.7.3 will still be available using python3
, or simply python
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With