Prefect 2.0
A custom image can be specified on the DeploymentSpec
using the flow_runner
keyword argument:
# docker_deployment.py
from prefect.flow_runners import DockerFlowRunner
from prefect.deployments import DeploymentSpec
DeploymentSpec(
...
# replace "prefecthq/prefect:2.0" by your custom image
flow_runner=DockerFlowRunner(image="prefecthq/prefect:2.0"),
)
Prefect 1.0
A custom image can be set as part of a run configuration:
from prefect.run_configs import DockerRun
from prefect import Flow
with Flow("flow_name", run_config=DockerRun(image="prefecthq/prefect:1.0"),) as flow:
...