Usage of USB devices in a swarm


I have a project in mind and would like to get your opinion on it.

I would like to build a docker swarm with two raspberry pi and I have an external HDD which contains data which should be accessible on both swarm nodes.

  1. Question: If I connect the HDD to the USB port of one pi, how do I define a volume for the container because I do not know on which node it will start.

  2. Question: How about the system load? In case I connect the HDD to node 1 and the container is running on node 2, I do have load on both nodes as data flow goes from HDD through node 1 to node 2, right? Is there any best practice available to manage this?



I would also be interested in how to use external disks for multiple nodes, because I have something similar in mind.


have you considered using docker-volume-netshare? My brief idea: Connect the HDD to a node, share the HDD via SAMBA or NFS. Create a volume like this in yaml (example is for CIFS):

    driver: cifs
        cifsopts: vers=3.0,uid=1000,gid=1000,dir_mode=0770,file_mode=0770,user=username,password=supersecretpassword



Thanks for your response…

I already begin to try to connect my HDDs on a Master, build my filesystem/raid whatever and try it with

Do you think its a good idea?

Well, in principal it’s the same idea, but just with another protocol. I already made some good experience with the docker-volume-netshare plugin and the cifs driver. Maybe i will try the sshfs driver as well.
I like the idea to use ssh public keys for connections. It might be a bit easier to maintain, and also the integration into docker secrets could be simplified by that.