Multiple containers writing to a bind mount

axlrose

New Member
Jul 31, 2017
6
1
3
55
Are there any dangers of multiple containers bind mounting the same directory and writing to it? I assume the host handles the actually writing so things stay in sync and there aren't any collisions but I just wanted to check.
 
  • Like
Reactions: Pablo Alcaraz
A bind mount is a bind mount - all writes are handled by the host kernel. So there is no concurrency control, like with any other linux file system (not sure if I understand your question correctly).
 
A bind mount is a bind mount - all writes are handled by the host kernel. So there is no concurrency control, like with any other linux file system (not sure if I understand your question correctly).

So if 2 containers try to write to the same file, if container A opens the file and locks it, container B open file operation will fail. Is that correct?
 
yes (if the file system supports that kind of locks).

It will be ZFS. To echo what Pablo said, I was wondering if multiple containers could write to a bind mounted directory without issue.

You need a file server aka samba, nfs and so on - can provide a lock system or a concurrent writing from many clients.

This is not desirable for me as unprivileged containers can't mount samba or NFS shares without compromising security.
 
It will be ZFS. To echo what Pablo said, I was wondering if multiple containers could write to a bind mounted directory without issue.



This is not desirable for me as unprivileged containers can't mount samba or NFS shares without compromising security.

sshfs ?