python-on-whales
A Docker client for Python, designed to be fun and intuitive!
Decision gist · record as of 2026-08-14
Yes. The package has low install friction, active maintenance, no known vulnerabilities, and a permissive MIT License. It solves a real problem—making Docker operations accessible and type-safe from Python—and is well-positioned for automation, testing, and CI/CD use cases. Install it if you need to orchestrate Docker from Python code.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Docker or Podman to be installed and running on the system; Python 3.8 or above.
- Low install friction with only two lightweight runtime dependencies (pydantic and typing-extensions).
- Active maintenance with recent commits and steady releases since 2020.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
last release 2026-03-09 (158 days) · last repo commit 2026-06-27 · 709 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 12,831,777 downloads/mo, #1,303 on PyPI
Alternatives
Verify before relying
pip install python-on-whales
from python_on_whales import docker
output = docker.run("hello-world")
print(output)- Whether the package supports Podman as a full alternative to Docker or only partial compatibility.
- Performance characteristics when managing large numbers of containers or images.
- Full scope of Docker Compose features supported through the python-on-whales API.
What it is and what it does
python-on-whales is a Python wrapper around the Docker CLI that translates Docker commands into intuitive Python method calls. Instead of shelling out to docker run or docker build, you call methods directly from Python code like run(), build(), pull(), and compose operations. It handles container lifecycle management, image operations, volume creation, networking, and Docker Compose orchestration.
The package is designed as a thin, direct mapping of Docker CLI operations to Python, so developers familiar with Docker commands can immediately recognize the equivalent Python calls. It depends on pydantic and typing-extensions for data validation and type hints, and requires Docker or Podman to be installed separately on the host system. The API returns Python objects that can be used as context managers to ensure cleanup, making it suitable for automation scripts, testing frameworks, and CI/CD pipelines.
Use it for
- Automate container lifecycle in Python test suites by spinning up, configuring, and tearing down containers programmatically.
- Build and push Docker images from Python scripts without subprocess calls or shell escaping.
- Orchestrate multi-container applications using Docker Compose from Python code.
- Copy files between host and containers, manage volumes, and inspect running containers in deployment automation.
- Integrate GPU-enabled containers into Python applications with native parameter passing.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package has low install friction, active maintenance, no known vulnerabilities, and a permissive MIT License. It solves a real problem—making Docker operations accessible and type-safe from Python—and is well-positioned for automation, testing, and CI/CD use cases. Install it if you need to orchestrate Docker from Python code.
Install
python-on-whales on PyPI
Before you install
Low install friction with only two lightweight runtime dependencies (pydantic and typing-extensions). Active maintenance with recent commits and steady releases since 2020.
Requires Docker or Podman to be installed and running on the system; Python 3.8 or above.
License in practice
MIT License permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
Quickstart
pip install python-on-whales
from python_on_whales import docker
output = docker.run("hello-world")
print(output)
Verify before relying
- Whether the package supports Podman as a full alternative to Docker or only partial compatibility.
- Performance characteristics when managing large numbers of containers or images.
- Full scope of Docker Compose features supported through the python-on-whales API.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release <4,>=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespydantictyping-extensions |
| Maintenance | Actively maintained 158 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 12,831,777 / month, #1,303 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: python_on_whales-0.81.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “docker client python”
- python-on-whalesA Python Docker client that wraps the Docker CLI with an intuitive,…
- docker-pyA Python client library that lets you control Docker containers,…
- aiodockerProvides async/await bindings for the Docker HTTP API, letting you…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also docker-py · awslambdaric · dockerfile · docker-image-py · pulumi-docker-build · testcontainers-postgres · pg0-embedded · azure-containerregistry · docker-compose · fspath