docker-py
Python client for Docker.
What it is and what it does
docker-py is a Python wrapper around the Docker Remote API that lets you manage containers, images, and other Docker resources from Python code instead of shell commands. It exposes the same operations available in the docker CLI—starting and stopping containers, pulling and pushing images, inspecting logs, managing networks—but as Python method calls. The library has no runtime dependencies, making it lightweight to install.
The package is actively maintained and widely used (top 5000 on PyPI with over 1 million monthly downloads), though the latest release on PyPI dates to 2016. It carries no known security vulnerabilities and is licensed permissively under Apache 2.0, making it safe for commercial use.
Use it for:
- Automate container orchestration and lifecycle management (start, stop, restart) from Python applications.
- Build deployment tools or CI/CD pipelines that programmatically manage Docker containers and images.
- Monitor and inspect running containers, logs, and resource usage from Python monitoring scripts.
- Pull and push Docker images to registries as part of automated build or release workflows.
- Test Python applications by spinning up and tearing down containerized services in test suites.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Python client library that lets you control Docker containers, images, and services programmatically through the Docker Remote API instead of using the command line.
Yes, if you need to control Docker from Python and your environment supports the Docker daemon. The library is lightweight, permissively licensed, and actively maintained. However, verify that this is still the recommended Docker client for your Python version—the latest PyPI release is from 2016, and the modern Docker Python client may have a different package name or location.
Install
docker-py on PyPI
pip
pip install docker-pyuv
uv add docker-pypoetry
poetry add docker-pyInstalling docker-py
Before you install
Low install friction with no runtime dependencies. The package is actively maintained with recent commits, though the latest PyPI release dates to 2016-11-02; the repository itself shows ongoing activity as of 2026-08-13.
License in practice
Licensed under Apache License, Version 2.0 (permissive), which allows commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install docker-py
import docker
client = docker.Client()
containers = client.containers()
Requires a running Docker daemon accessible to the Python process; connection details may need configuration depending on your Docker setup.
Verify before relying
- Whether this package is still the recommended Docker client for Python (the modern package may be named differently).
- Current Python version support—classifiers list Python 2.6–3.5, but requires_python is unspecified and the latest release is from 2016.
Package facts
| License | UNKNOWN (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 3,572 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,074,698/month — #4,405 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docker_py-1.10.6-py2.py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
dockerA Python library that lets you programmatically…
permissive · top 1,000 on PyPI
pylxdpylxd provides a Python interface to the LXD…
permissive · top 15,000 on PyPI
python-on-whalesA Python Docker client that wraps the Docker…
permissive · top 5,000 on PyPI
docker-pycredsProvides Python bindings to interact with…
permissive · top 5,000 on PyPI
pipmasterProgrammatically ensures Python packages are…
permissive · top 15,000 on PyPI
podmanProvides Python bindings to the Podman…
permissive · top 15,000 on PyPI
dockerptyOperates the pseudo-terminal (PTY) allocated to…
permissive · top 15,000 on PyPI
python-digitaloceanProvides Python bindings to the DigitalOcean…
copyleft · top 15,000 on PyPI
tox-dockerA tox plugin that manages Docker container…
permissive · top 15,000 on PyPI
spythonspython is a Python API for programmatically…
unclear · top 5,000 on PyPI