[Lxc-users] Container start unmounts shared bind mounts

Serge Hallyn serge.hallyn at canonical.com
Thu Feb 9 18:30:29 UTC 2012

Quoting Ivan Vilata i Balaguer (ivan at selidor.net):
> Hi all.  I'm running Debian's LXC 0.7.5 under Linux 3.2.0.  I've set up
> a shared mountpoint to dynamically export some host directories into one
> container, like this::
>   # mkdir -p /lxc-shared
>   # mount --bind /lxc-shared /lxc-shared
>   # mount --make-unbindable /lxc-shared
>   # mount --make-shared /lxc-shared

(I should think more before answering, but ...)

What if you do 'mount --make-rslave /lxc-shared' here?  That should
prevent the container's mount actions from being forwarded to the

> Now I bind mount the host directory under the shared directory::
>   # mkdir -p /lxc-shared/myvm/foo
>   # mount --bind /tmp /lxc-shared/myvm/foo
> The problem is that whenever I start any container, /lxc-shared/myvm/foo
> gets unmounted (even if it has processes working under it!).  This
> affects bind mounts only if they are under shared mountpoints, e.g. if I
> also do this mount on the host::
>   # mount --bind /tmp /mnt
> It survives after starting the container.
> Does anyone know why does this happen?  Should I file a bug report?
> Thanks a lot!

More information about the lxc-users mailing list