Debian-based (Debian and Ubuntu) Python
50K+
Tags follow the format <python-version>[-<variant(ext|perf)>][-<base-image-ref>].
âšī¸ Note: If the base-image variant is
latest, the<base-image-ref>refers to the base-image name, otherwise<base-image-ref>refers to the base-image variant.
Example:
- If the base-image is
ubuntu:latest, then<base-image-ref>will beubuntu(the base-image name).- If base-image is
debian:bookworm-slim, then<base-image-ref>will bebookworm-slim(the base-image variant).
| Ubuntu ( ubuntu:latest) | Debian ( debian:bookworm-slim) | Python Version | Notes |
|---|---|---|---|
unstable-ubuntuâ , unstableâ | unstable-bookworm-slimâ | latest unstable | Uses the latest unstable version of Python |
3â , ubuntuâ , latestâ đ | bookworm-slimâ | latest stable | â Default build; uses the latest stable version of Python |
3.14-ubuntuâ , 3.14â | 3.14-bookworm-slimâ | 3.14 | Standard build |
3.14-perf-ubuntuâ | 3.14-perf-bookworm-slimâ | 3.14 | PGO-optimized (ENABLE_OPTIMIZATIONS=true) |
3.14-ext-ubuntuâ | 3.14-ext-bookworm-slimâ | 3.14 | Dev build with extended tooling |
3.13-ubuntuâ , 3.13â | 3.13-bookworm-slimâ | 3.13 | Standard build |
3.12-ubuntuâ , 3.12â | 3.12-bookworm-slimâ | 3.12 | Standard build |
3.12-perf-ubuntuâ | 3.12-perf-bookworm-slimâ | 3.12 | PGO-optimized (ENABLE_OPTIMIZATIONS=true) |
3.12-ext-ubuntuâ | 3.12-ext-bookworm-slimâ | 3.12 | Dev build with extended tooling |
3.11-ubuntuâ , 3.11â | 3.11-bookworm-slimâ | 3.11 | Standard build |
3.10-ubuntuâ , 3.10â | 3.10-bookworm-slimâ | 3.10 | Standard build |
| Debian ( dhi.io/debian-base:bookworm-debian12-dev) | Python Version | Notes |
|---|---|---|
3.12-bookworm-debian12-devâ | 3.12 | Standard build |
3.14-bookworm-debian12-devâ | 3.14 | Standard build |
Source Dockerfile:
github.com/stairwaytowonderland/cpython/blob/main/docker/Dockerfileâ
GitHub Repository:
github.com/stairwaytowonderland/cpythonâ
Docker Hub:
stairwaytowonderland/cpythonâ
Base Images:
All images are built on top of Debian-based base images. The default base is ubuntu:latest.
âšī¸ Note: The
Dockerfilerequires a Debian-based image. Other Debian-derived distributions may be used via theIMAGE_NAMEandVARIANTbuild arguments.
| Base Image | Variant |
|---|---|
dhi | bookworm-debian12-dev |
ubuntu | latest |
debian | bookworm-slim |
Supported architectures:
linux/amd64, linux/arm64
Source of this description:
docsâ
A self-maintained Python Docker image that builds CPythonâ from source on top of a Debian-based (Debian or Ubuntu) base image. Designed for use as a lightweight, customizable Python runtime in container-based workflows.
Inspired by a personal desire for a production-grade, Ubuntu-based Python "base" image.

DockerfileUse one of the published images as a base for your own application image:
FROM stairwaytowonderland/cpython:3
WORKDIR /usr/src/myapp
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./your-daemon-or-script.py" ]
Clone the repository and use the provided build script from the project root:
# Build with the default Python version (latest) targeting the base stage
./docker/bin/build.sh cpython .
# Build a specific Python version
./docker/bin/build.sh cpython \
--build-arg PYTHON_VERSION=3.14 \
.
# Build with PGO optimizations enabled
./docker/bin/build.sh cpython \
--build-arg PYTHON_VERSION=3.14 \
--build-arg ENABLE_OPTIMIZATIONS=true \
.
Or build directly with docker build:
docker build \
--build-arg PYTHON_VERSION=3.14 \
--target base \
-t cpython:3.14-ubuntu \
-f docker/Dockerfile \
.
Run a one-off Python command using the image:
docker run --rm stairwaytowonderland/cpython:3.14-ubuntu python3 --version
Run an interactive Python shell:
docker run -it --rm stairwaytowonderland/cpython:3.14-ubuntu python3
docker run --rm \
-v "$(pwd)":/usr/src/myapp \
-w /myapp \
stairwaytowonderland/cpython:3.14-ubuntu \
python3 your-daemon-or-script.py
cpython:<version>-ubuntuThis is the defacto image. Built on ubuntu:latestâ . Ubuntu is a widely used,
well-supported Debian-based distribution with a large package ecosystem. This is the default base image and a good
general-purpose choice for most workloads.
cpython:<version>-bookworm-slimBuilt on debian:bookworm-slimâ . Debian Bookworm Slim is a minimal Debian 12 image
that strips non-essential packages to reduce the image footprint. A good choice when image size is a priority and
Ubuntu-specific tooling is not required.
cpython:<version>-perf-<base-image-ref>A performance-optimized build with Profile-Guided Optimization (PGO)â
enabled (ENABLE_OPTIMIZATIONS=true). PGO uses runtime profiling data collected during the build to produce a faster
CPython binary. Recommended for production workloads where CPU performance matters. Available for both ubuntu and
bookworm-slim base variants.
cpython:<version>-ext-<base-image-ref>A development-oriented build with extended tooling included (PYTHON_DEV=true). Intended for use in development
environments and dev containers where additional build tools and libraries may be needed. Available for both ubuntu and
bookworm-slim base variants.
cpython:<version>-bookworm-debian12-devBuilt on dhi.io/debian-base:bookworm-debian12-devâ . This is the default base image for this project â
a custom Debian 12 (Bookworm) base image maintained by dhi.ioâ , purpose-built for Debian-based container
workflows. It provides a curated, dev-friendly foundation with common tooling pre-installed, making it well-suited for
both development and CI environments.
This project is licensed under the GPL-3.0 Licenseâ â free to use, modify, and distribute with attribution and original copyright notices.
See the LICENSEâ file for the full license text.
Content type
Image
Digest
sha256:bd8b77eb9âĻ
Size
78.1 MB
Last updated
about 13 hours ago
docker pull stairwaytowonderland/cpython