python

An image used for application development, scripting, data analysis, and deploying Python-based web frameworks.

jupyter/base-notebook
tensorflow/tensorflow
pytorch/pytorch
Debian

What is python?

The python image provides a containerized runtime environment for Python applications, bundling the Python interpreter, standard libraries, and dependency management tools like pip. Python is one of the most widely used programming languages in the world, valued for its readability, large ecosystem of libraries, and versatility across domains.

This image is commonly used to develop and run web applications (with frameworks like Django, Flask, or FastAPI), build data pipelines and analytics tools (with Pandas, NumPy, and SQLAlchemy), and power machine learning workloads (with TensorFlow, PyTorch, or scikit-learn). Beyond application development, Python is also a go-to language for scripting, automation, and CI/CD workflows, making the python image a useful foundation for DevOps teams.

In containerized infrastructure, the python image ensures consistency between development, testing, and production environments. Teams can pin library versions, preinstall dependencies, and guarantee that runtime behavior is reproducible across hosts and clusters. Its relevance in modern infrastructure comes from balancing ease of use for developers with a stable, portable runtime for production systems.

How to use this image?

The python image can be run interactively for quick experimentation, used to execute local scripts, or serve as a base image for building custom application containers. It supports volume mounting for development workflows, but for production reproducibility, dependencies are typically baked into the image itself.

Run Python interactively:

<code>docker run -it python</code>

Run a script from your local machine:

<code>docker run --rm -v $(pwd):/app -w /app python python script.py</code>

Build a custom image with dependencies preinstalled:

<code>FROM python:3.12-slimWORKDIR /appCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txtCOPY . .CMD ["python", "app.py"]</code>

Install packages on the fly:

<code>docker run -it python pip install requests</code>

Logs and application output are written to stdout and stderr, which can be viewed using docker logs. By default, containers exit when the script or application terminates unless run interactively.

{{cta}}

Image variants

Published under python, the image is available in multiple variants:

python:latest

Tracks the most recent stable release of Python.Use for testing or dev environments, but avoid in production due to version drift.

python:<version>

Tagged by major and minor versions (e.g. 3.12, 3.11).Recommended for reproducibility across builds.

python:<version>-slim

Debian-based, reduced size by excluding non-essential libraries and tools. Good balance of functionality and footprint.

python:<version>-alpine

Ultra-lightweight Alpine Linux variant. Best for minimal builds, but some packages with native extensions may require extra effort.

python:<version>-windowsservercore

Windows-specific variants for use with Windows containers.Python images are rebuilt regularly to incorporate upstream security updates. For stable production environments, it’s best to pin to a specific versioned tag (e.g. python:3.12.3-slim) to ensure reproducibility.

Interested in base images that start and stay clean?

This is a not a valid email
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Interested in a CVE-free python?

Pull echo’s python image for a CVE-free base. Automatically patched and hardened for you.