[lxc-users] How to bind-mount host filesystem inside a container and change mount options

Serge Hallyn serge.hallyn at ubuntu.com
Mon Sep 14 16:53:10 UTC 2015


Quoting Leonid Isaev (leonid.isaev at jila.colorado.edu):
> Hi,
> 
> 	I am trying to mount a user home directory from the host to a container
> and at the same time change its mount options. The lxc.mount= option is:
> ----------
> (host): grep fstab /tmp/config
> lxc.mount=/var/lib/lxc/node1/fstab
> (host): cat /tmp/fstab 
> /export/home /var/lib/lxc/node1/rootfs/export/home/takahe none bind 0 0
> /export/home /var/lib/lxc/node1/rootfs/export/home/takahe none remount,exec,bind 0 0

Note that if you just specify bind,ro, then lxc should automatically
do the double-mount for you.  (see src/lxc/conf.c:mount_entry()).

However, the bad news for you is that the kernel will not allow you
to remount it with MS_EXEC, for security reasons.

-serge


More information about the lxc-users mailing list