Hey! How can I mount volumes on a specific flow wi...
# ask-community
m
Hey! How can I mount volumes on a specific flow without affecting the global configuration of docker agent as described here https://docs.prefect.io/orchestration/agents/docker.html#mounting-volumes
đź‘€ 2
k
Hey @marios, it doesn’t seem like you can because we use
docker-py
and mounts are done in 2 parts. First is the
host_config
and second is the
volumes
. It looks like this:
Copy code
client.api.create_container(
    'busybox', 'ls', volumes=['/mnt/vol1', '/mnt/vol2'],
    host_config=client.api.create_host_config(binds=[
        '/home/user1/:/mnt/vol2',
        '/var/www:/mnt/vol1:ro',
    ])
)
The
DockerRun
run configuration from Prefect lets you pass in a
host config
, so that part is fine, but it still needs to be added in the
volumes
, which comes from the agent unfortunately. This might be worth opening a ticket for and seeing if we can pass volumes through the RunConfig as well. I’ll dig in if this is feasible.
m
Thanks @Kevin Kho!
k
@Marvin archive “Mount Volumes to Docker RunConfig”