Docker Community Forums

Share and learn in the Docker community.

Why is docker python image based specifically on Debian Buster?

Totally new to docker, sorry if the question is too basic and naive. I also asked some similar docker related questions on stackoverflow, but they say We don’t allow questions about general computing hardware and software on Stack Overflow. So hopefully this forum is more apt for it.

I am building a docker container starting from python 3.6 as my base image for my flask application. The first line of the Dockerfile looks like

FROM python:3.6.9

When I get inside the container and want to see the OS version, it shows debian.

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

I understand any python interpreter has to be hosted by an operating system, but why Debian buster in particular when I have not mentioned that anywhere? Why not, for example, based on Linux Mint or Arch? If, for example, I want a python application to run on Manjaro, then do I have to start from Manjaro base image with FROM manjaro and install the utilities in my Dockerfile to get where I want?

In general, whenever I pick a higher level image like Python, how does Docker pick the lower level components such as the OS. Is there a default list somewhere?

1 Like

The python:3.6.9 tag simply inherits the “os” from its base image, which happens to be Debian buster for this image.

The python repository usualy provides several tags for the same python version based on different base images, though for this repo the range is limited to Debian, Alpine and Windows versions. On Dockerhub, you can click the “tags” tab and enter the version you want in the search field (the one with the magnifier glass icon) and check the available tags yourself.

May I suggest this faboulus, free, self paced docker training to build up a better understanding of docker? https://container.training/intro-selfpaced.yml

1 Like

There are three major operating systems that roughly meet the above criteria (dates and release versions are accurate at time of writing; the passage of time may require slightly different choices).

Ubuntu 18.04 (the ubuntu:18.04 image) was released in April 2018, and since it’s a Long Term Support release it will get security updates until 2023.
Ubuntu 20.04 (the ubuntu:20.04 image) will be released in late April 2020, and since it’s a Long Term Support release it will get security updates until 2025.
CentOS 8 (centos:8) was released in 2019, and will have full updates until 2024 and maintenance updates until 2029.
Debian 10 (“Buster”) was released on July 6th 2019, and will be supported until 2024.
Only Ubuntu 20.04 includes the latest version of Python (until 3.9 is out, anyway), so you’ll have to install Python yourself.

There are three major operating systems that roughly meet the above criteria.

What criteria are you talking about?

Also, my question was when installing from base image python3.6, why is the operating system debian-buster in particular and not something else (whether some other debian or centos for example)

The python:3.6.9 tag simply inherits the “os” from its base image

Yes, this what I am asking. So, if for example I want python3.6.9 running on Linux Mint or Manjaro, how would the dockerfile look like? Would you mind to give an example, whether by entering the sample docker commands here or by pointing me to some reference/github project etc.?

So this boild down to let me to a “let me google this for you” request.

The first result of googling “python docker github” is https://github.com/docker-library/python, which is the Github repo of the official python image. Check the different Dockerfiles.

Also, I would like to suggest this fabulous free self-paced docker training to get a better understanding of how Docker works and things need to be done: https://container.training/intro-selfpaced.yml.html
Of course building images is covered there as well.

Good luck!