Binding docker volumes to containers run by workers

Hello everyone,
I’m new to Prefect and work orchestration. With this out of the way, here is my issue:

Prefect 2.14

I have a flow defined in a docker image and I can deploy the image using a local worker and local Prefect server instance. The worker pulls the image, creates a conatiner and runs the flow just fine. Now I need the worker to mount a docker volume when creating the container. As far as I understand, this was/is possible using a Prefect agent together with a docker infrasructure. However the docs state, that workers are recommended over agents. Is there a way to tell the worker to mount the volume? I neither have found a way to do this in the work pools base job template nor a way to do this with the prefect.yaml.
Idealy I would like to do something like this in my prefect.yaml:




- name: flow_example
    name: local-docker-pool
    work_queue_name: default
      image: registry.private_gitlab/prefect_example:latest
>>>   volumes:
>>>     - prefect-test:/data

Thanks for reading

1 Like

Meanwhile I just went the agent + infrastructure-block route which works fine. But the question remains since agents are discuraged in the docs.