Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get python2.7 and 3.7 both installed in an alpine docker image

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.

like image 835
jacesij5 Avatar asked May 12 '19 23:05

jacesij5


People also ask

Does alpine image have Python?

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!

What version of Python does Docker use?

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.


Video Answer


1 Answers

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.

like image 63
grooveplex Avatar answered Oct 12 '22 13:10

grooveplex