miguelbalmeida
05/21/2026, 4:14 PMMarvin
05/21/2026, 4:14 PMMarvin
05/21/2026, 4:16 PMtype = "docker"
- default job variables like image, env, networks, etc.
- Deployment targets that pool
- Worker listens to that pool and launches Docker containers
Example shape in Terraform for the pool:
hcl
resource "prefect_work_pool" "docker" {
name = "docker-pool"
type = "docker"
job_variables = jsonencode({
image = "my-registry/my-image:latest"
image_pull_policy = "IfNotPresent"
env = {
PREFECT_LOGGING_LEVEL = "INFO"
}
})
}
Then your deployment can target that pool.
In Prefect 3, I’d usually recommend one of these two patterns:
Option A: Terraform for pool, Python for deployment
- Create/manage the Docker work pool in Terraform
- Define/update deployments in code with flow.deploy(...)
python
from prefect import flow
@flow
def my_flow():
print("hello from docker")
if __name__ == "__main__":
my_flow.deploy(
name="my-flow-docker",
work_pool_name="docker-pool",
image="my-registry/my-image:latest",
push=False,
)
Option B: Terraform for both pool and deployment
- Useful if you want the Prefect control-plane objects in Terraform state
- More “pure IaC”, but less code-centric than flow.deploy(...)
The important update is that for Prefect 3 you should not look for old 2.x patterns like:
- Deployment.build_from_flow()
- prefect deployment build
Those are not the modern path in 3.x.
Also, if you want the worker side, the CLI namespace is still work-pool / worker, but I wasn’t able to verify the exact CLI help output in time here, so I’d point you to the docs for the exact commands:
- Manage work pools
- Docker guide
If you want, I can give you a concrete end-to-end example of:
- Terraform for a Docker work pool
- a flow.deploy(...) deployment
- and the worker command to run it locally or in CI/CD.