skillfed

prefect-docker

Prefect integrations for interacting with Docker.

prefect-docker v0.7.3 2.3M downloads/30d#3,172 on PyPI23,623
Permissive license Apache License 2.0 Active released

What it is and what it does

prefect-docker is an official integration that extends Prefect's workflow orchestration to execute tasks inside Docker containers. It bridges the Prefect task execution model with Docker's containerization, letting you define and run workflow steps as isolated container workloads rather than in-process Python functions. The package wraps Docker and python-on-whales to manage container lifecycle and communication.

This is useful when you need task isolation, dependency management, or reproducible execution environments within a Prefect workflow. You define tasks normally in Prefect, then specify Docker container configuration to run them containerized. The integration handles container creation, execution, and cleanup as part of the Prefect task lifecycle.

Use it for:

  • Run Prefect tasks in isolated Docker containers to avoid dependency conflicts between workflow steps.
  • Execute workflow tasks with specific OS or system library requirements inside a container image.
  • Ensure reproducible task execution across different environments by containerizing task logic.
  • Integrate legacy or third-party applications into Prefect workflows by wrapping them in Docker containers.
  • Distribute task execution across container orchestration platforms by using Docker as the execution backend.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Docker task execution and container management integrations for Prefect workflow orchestration, enabling you to run Prefect tasks inside Docker containers.

Yes, if you use Prefect and need to run tasks in Docker containers. It's actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively. The integration is part of the official Prefect ecosystem. Install it when containerized task execution is part of your workflow design; skip it if you run all tasks in-process.

Install

prefect-docker on PyPI

pip

pip install prefect-docker

uv

uv add prefect-docker

poetry

poetry add prefect-docker

Installing prefect-docker

Before you install

Low install friction with a pure-Python wheel. Active maintenance—last commit 2026-08-14, released 30 days ago. Supports Python 3.10 through 3.13. Depends on prefect, docker, exceptiongroup, and python-on-whales; all are standard ecosystem packages.

License in practice

Licensed under Apache License 2.0 (permissive). You can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install prefect-docker

from prefect_docker import DockerContainer
from prefect import flow, task

@task
def my_task():
    return "Hello from Docker"

@flow
def my_flow():
    my_task.with_options(container=DockerContainer()).submit()

Requires Docker daemon running locally or accessible via docker socket; requires Prefect to be installed and configured.

Verify before relying

  • Specific Docker API features or container orchestration patterns this integration supports beyond basic task execution.
  • Whether this package handles Docker networking, volume mounting, or environment variable injection for containerized tasks.
  • Performance characteristics or scaling limits when running many concurrent Docker-based tasks.

Package facts

License Apache License 2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 4 — prefect, docker, exceptiongroup, python-on-whales
Maintenance actively maintained — 30 days since the last release
Last repo commit
First released
Downloads 2,275,795/month — #3,172 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: prefect_docker-0.7.3-py3-none-any.whl

Keywords: prefect

Intended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Libraries

Tags

prefect docker integrationrun tasks in docker containersdocker workflow orchestrationprefect container executiondocker task runnercontainerized prefect workflows
workflow-orchestrationdocker-integrationtask-execution

More Libraries packages