Docker does not keep track of what is mounted and what is not, it will
issue /Volume.Mount and /Volume.Unmount requests regardless when multiple
containers use the same volume simulatenosly. This leads to duplicate
mount entries and requirement for a careful cleanup of the mountpath in
this patch.
If same path is mounted multiple times, duplicate entries will occur
in mount table for the same mountpoint. These are mostly fine and harmless.
However umount will remove the mount entry and attempting to remove the
mountpoint at this time is not okay as it still has active mount(s).
In that case, we read the mount table to see if there is still something
mounted, and only when there is nothing mounted, we remove the mountpoint.
Docker does not keep track of what is mounted and what is not, it will issue /Volume.Mount and /Volume.Unmount requests regardless when multiple containers use the same volume simulatenosly. This leads to duplicate mount entries and requirement for a careful cleanup of the mountpath in this patch.
If same path is mounted multiple times, duplicate entries will occur in mount table for the same mountpoint. These are mostly fine and harmless. However umount will remove the mount entry and attempting to remove the mountpoint at this time is not okay as it still has active mount(s).
In that case, we read the mount table to see if there is still something mounted, and only when there is nothing mounted, we remove the mountpoint.
Fixes #23.
cc: @sascha-egerer