Run each task in a different Docker container using Prefect 2

Is there a way to run a Prefect 2 flow with a number of tasks that each run in separate Docker container and can each be assigned different resource requirements (CPU, memory, etc) ? I looked at, however that is using Prefect 1 and the same functions have changed significantly in Prefect 2.

How do you do the same using Prefect 2?

Hi @nss0204 :wave: Prefect lets you schedule flows in different infrastructures (such as containers). I imagine it’s possible to do something similar for tasks with Dask or Ray, but the most supported way is via flows. Here’s an example of what that looks like using Docker: GitHub - EmilRex/multi-container-demo

Notably, we use the run_deployment utility to schedule the additional flows which are then spawned in different Docker containers by the agent,

def run_deployment_task(deployment_name):
    """Run the deployment in a task for async execution"""

def parent():
    """Run three deployments in different docker containers"""
    deployment_names = [
    for deployment_name in deployment_names: