Peter Roelants

01/30/2021, 8:36 AM
Hi Prefect, How can I mount a predefined Docker volume when using the Docker Agent? For example I have a volume named
created with
docker volume create test-volume
If I want to mount the named docker volume
prefect agent docker start --volume test-volume:$DOCKER_DIR ...
, the named volume is never mounted into the runtime started by the agent, a new volume seems to be created and mounted each time.
Everything works as expected when I mount a regular local folder from my local host when starting the agent with
prefect agent docker start --volume "$HOST_DIR:$DOCKER_DIR" ...
The volumes mounted by the container that is started by the Docker Agent look like:
Copy code
"Mounts": [
                "Type": "volume",
                "Name": "d1bb31c7fea65bb5b99c427087f20a5d9659e6c9bf5324697a4dfe97141a7d82",
                "Source": "/var/lib/docker/volumes/d1bb31c7fea65bb5b99c427087f20a5d9659e6c9bf5324697a4dfe97141a7d82/_data",
                "Destination": "/root/download",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
My volumes look like:
Copy code
VOLUME NAME                                                        LINKS     SIZE
f1e51e432fc828a923e31fee3a5e9462585d70a0b3cec3cb97a16d1136d4bcb6   1         52.22MB
test-volume                                                        0         0B
d1bb31c7fea65bb5b99c427087f20a5d9659e6c9bf5324697a4dfe97141a7d82   1         5B
Am I doing something wrong, or should I file an issue?