What minor version does docker image python:3.12-slim use?

Any 3.12.X. The image tag is updated with each minor release.

How could it be that the pipeline is grabbing an older python version?

An old version of the image tag is cached on the machine. Because it exists, new version is not fetched. This is a configuration in gitlab-runner, see for example GitLab runner pulls image for every job .

If you intend to use 3.12.3, then the docker python project happens to also have :3.12.3-slim docker tag.

Answer from KamilCuk on Stack Overflow
🌐
Docker Hub
hub.docker.com › _ › python
python - Official Image | Docker Hub
3.12.13-trixie⁠ · 3.11.15, 3.11: 3.11.15-trixie⁠ · 3.10.20, 3.10: 3.10.20-trixie⁠ · Where to file issues: https://github.com/docker-library/python/issues⁠ · Supported architectures: (more info⁠) amd64⁠, arm32v5⁠, arm32v6⁠, arm32v7⁠, arm64v8⁠, i386⁠, ppc64le⁠, riscv64⁠, s390x⁠, windows-amd64⁠ · Published image artifact details: repo-info repo's repos/python/ directory⁠ (history⁠) (image metadata, transfer size, etc) Image updates: official-images repo's library/python label⁠ official-images repo's library/python file⁠ (history⁠) Source of this description: docs repo's python/ directory⁠ (history⁠) Python is an interpreted, interactive, object-oriented, open-source programming language.
🌐
Python⇒Speed
pythonspeed.com › articles › base-image-python-docker-images
The best Docker base image for your Python application (February 2026)
February 4, 2026 - 3.12: Latest point release is 3.12.12, from October 2025. Here is what the different sources of Python provided: So if you want the most up-to-date bug fixes for Python, the Docker python image uv managed are your best bet.
🌐
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%
🌐
ECR Public Gallery
gallery.ecr.aws › docker › library › python
Amazon ECR Public Gallery - Docker/library/python
3.12.0-windowsservercore-1809, 3.12-windowsservercore-1809, 3-windowsservercore-1809, windowsservercore-1809 ... Supported architectures: (more info) amd64, arm32v5, arm32v6, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x, windows-amd64 · Published image artifact details: repo-info repo's repos/python/ directory (history) (image metadata, transfer size, etc)
Find elsewhere
🌐
Docker Hub
hub.docker.com › r › ubuntu › python
ubuntu/python - Docker Image
Current Python Docker Image from Canonical⁠, based on Ubuntu. Receives security updates and rolls to newer Python or Ubuntu release.
🌐
Astral
docs.astral.sh › uv › guides › integration › docker
Using uv in Docker | uv
1 day ago - Use one of the above images with uv pre-installed or install uv by copying the binary from the official distroless Docker image: ... FROM python:3.12-slim-trixie # The installer requires curl (and certificates) to download the release archive RUN apt-get update && apt-get install -y ...
🌐
Stack Overflow
stackoverflow.com › questions › 77671355 › docker-image-python3-12-alpine-behaves-different-on-windows-and-debian
Docker image python:3.12-alpine behaves different on Windows and Debian - Stack Overflow
I have build my Fastapi project on my Windows machine and I can successfully run it and build the image. But when I want to run the project on a Raspberry Pi 4 with Debian 12 Bookworm with docker --version > v24.0.7 it fails while telling me that it cannot find a C compiler (gcc). It fails at the step where pip installs the packages from requirements.txt. ... FROM python:3.12-alpine LABEL authors="Raphael2b3" ADD requirements.txt ./ RUN pip install --upgrade pip RUN pip install -r requirements.txt RUN rm -f ./requirements.txt ADD .
🌐
CircleCI
circleci.com › developer › images › image › cimg › python
cimg/python - CircleCI
The browsers variant can be used by appending -browser to the end of an existing cimg/python tag. The browsers variant is designed to work in conjunction with the CircleCI Browser Tools orb. You can use the orb to install a version of Google Chrome and/or Firefox into your build. The image contains all of the supporting tools needed to use both the browser and its driver. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 orbs: browser-tools: circleci/browser-tools@1.1 jobs: build: docker: - image: cimg/python:3.7-browsers steps: - browser-tools/install-browser-tools - checkout - run: | python --version node --version java --version google-chrome --version
🌐
TestDriven.io
testdriven.io › blog › docker-best-practices
Docker Best Practices for Python Developers | TestDriven.io
February 12, 2024 - Multi-stage Docker builds allow you to break up your Dockerfiles into several stages. For example, you can have a stage for compiling and building your application, which can then be copied to subsequent stages. Since only the final stage is used to create the image, the dependencies and tools associated with building your application are discarded, leaving a lean and modular production-ready image. ... # temp stage FROM python:3.12.2-slim as builder WORKDIR /app ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 RUN apt-get update && \ apt-get install -y --no-install-recommends gcc COPY requirements.txt .
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python › deploy python lambda functions with container images
Deploy Python Lambda functions with container images - AWS Lambda
. When you deploy a container image to Lambda, Lambda automatically defines a default Linux user with least-privileged permissions. This is different from standard Docker behavior which defaults to the root user when no USER instruction is provided. FROM public.ecr.aws/lambda/python:3.12 # Copy requirements.txt COPY requirements.txt ${LAMBDA_TASK_ROOT} # Install the specified packages RUN pip install -r requirements.txt # Copy function code COPY lambda_function.py ${LAMBDA_TASK_ROOT} # Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile) CMD [ "lambda_function.handler" ]
🌐
Red Hat
catalog.redhat.com › en › software › containers › ubi8 › python-312 › 657c12cade3664622a12ed50
Python 3.12 - Red Hat Ecosystem Catalog
July 15, 2025 - To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: FROM registry.fedoraproject.org/f33/python3 # Add application sources to a directory that the assemble script expects them # and set permissions so that the container runs without root access USER 0 ADD app-src /tmp/src RUN /usr/bin/fix-permissions /tmp/src USER 1001 # Install the dependencies RUN /usr/libexec/s2i/assemble # Set the default command for the resulting image CMD /usr/libexec/s2i/run