Take a closer look at the output from apt-get when you attempt to install python3.10:

root@3d5f9653d655:/# apt-get -y install python3.10
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libqgispython3.10.4' for regex 'python3.10'
Note, selecting 'libpython3.10-stdlib' for regex 'python3.10'
libqgispython3.10.4 is already the newest version (3.10.4+dfsg-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.

It treats python3.10 like a regular expression, and matches it against libqgispython3.10.4. There is no python3.10 package available, and if you were to use the apt command instead of apt-get you would get a better error message:

root@3d5f9653d655:/# apt install python3.10
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.10
E: Couldn't find any package by glob 'python3.10'

This behavior is documented in the apt-get man page:

If no package matches the given expression and the expression contains one of ., ? or * then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so lo.* matches how-lo and lowest. If this is undesired, anchor the regular expression with a ^ or $ character, or create a more specific regular expression.

It's a dumb behavior, particularly because packages name legitimately contain . characters, but we're apparently stuck with it.

Answer from larsks on Stack Overflow
🌐
Docker Hub
hub.docker.com › _ › python
python - Official Image | Docker Hub
For many simple, single file projects, you may find it inconvenient to write a complete Dockerfile. In such cases, you can run a Python script by using the Python Docker image directly: $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp python:3 python your-daemon-or-script.py Copy
Top answer
1 of 1
4

Take a closer look at the output from apt-get when you attempt to install python3.10:

root@3d5f9653d655:/# apt-get -y install python3.10
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libqgispython3.10.4' for regex 'python3.10'
Note, selecting 'libpython3.10-stdlib' for regex 'python3.10'
libqgispython3.10.4 is already the newest version (3.10.4+dfsg-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.

It treats python3.10 like a regular expression, and matches it against libqgispython3.10.4. There is no python3.10 package available, and if you were to use the apt command instead of apt-get you would get a better error message:

root@3d5f9653d655:/# apt install python3.10
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.10
E: Couldn't find any package by glob 'python3.10'

This behavior is documented in the apt-get man page:

If no package matches the given expression and the expression contains one of ., ? or * then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so lo.* matches how-lo and lowest. If this is undesired, anchor the regular expression with a ^ or $ character, or create a more specific regular expression.

It's a dumb behavior, particularly because packages name legitimately contain . characters, but we're apparently stuck with it.

🌐
Python⇒Speed
pythonspeed.com › articles › base-image-python-docker-images
The best Docker base image for your Python application (February 2026)
February 4, 2026 - Another alternative is Docker’s own “official” python image, which comes pre-installed with respective versions of Python (3.10, 3.11, 3.12, etc.), and has multiple variants:
🌐
GitHub
github.com › docker-library › python
GitHub - docker-library/python: Docker Official Image packaging for Python · GitHub
This is the Git repo of the Docker "Official Image" for python (not to be confused with any official python image provided by python upstream).
Starred by 2.7K users
Forked by 1.1K users
Languages   Dockerfile 50.3% | Shell 49.7%
Find elsewhere
🌐
Medium
medium.com › @nikhil.nagarajappa › installing-python-3-10-version-in-centos-dockerfile-4d556d5a3c14
Installing Python 3.10 version in Centos Dockerfile | by Nikhil YN | Medium
December 13, 2023 - In conclusion, creating a Dockerfile for installing Python 3.10 in a CentOS-based Docker image provides a standardized and portable environment for running Python applications. This Dockerfile outlines the necessary steps to set up the CentOS ...
🌐
GitHub
github.com › snakepacker › python
GitHub - snakepacker/python: Python docker images · GitHub
Just create a Dockerfile with the following content: ################################################################# ####################### BUILD STAGE ############################# ################################################################# # This image contains: # 1. All the Python versions # 2. required python headers # 3. C compiler and developer tools FROM ghcr.io/snakepacker/python:all as builder # Create virtualenv on python 3.10 # Target folder should be the same on the build stage and on the target stage RUN python3.10 -m venv /usr/share/python3/app # Install target package R
Starred by 78 users
Forked by 17 users
Languages   Dockerfile 84.7% | Makefile 8.5% | Python 5.5% | Shell 1.3%
🌐
GitHub
github.com › tiangolo › uvicorn-gunicorn-docker › blob › master › docker-images › python3.10.dockerfile
uvicorn-gunicorn-docker/docker-images/python3.10.dockerfile at master · tiangolo/uvicorn-gunicorn-docker
FROM python:3.10 · · ENV PYTHONDONTWRITEBYTECODE=1 · ENV PYTHONUNBUFFERED=1 · · LABEL maintainer="Sebastian Ramirez <tiangolo@gmail.com>" · COPY requirements.txt /tmp/requirements.txt · RUN pip install --no-cache-dir -r /tmp/requirements.txt · · COPY ./start.sh /start.sh ·
Author   tiangolo
🌐
Medium
medium.com › @tshradheya › is-from-python-3-10-good-enough-for-dockerfile-9a82c2505349
Is “FROM python:3.10” good enough for Dockerfile? | by Shradheya Thakre | Medium
June 14, 2024 - I could essentially solve it by either explicitly installing oscrypto in my requirements.txt which would then override the one by dbt-snowflake but the right way to fix was to use the old working docker image for more stability in future and less slack alerts :) FROM python:3.10@sha256:13ef6a071d6a1aaf839bbcb9bbf80c749f26b92ed28ad87e759a14b54e4a2f16