[lxc-users] Is calling external mount-binding scripts supported with Ubuntu's upstart scripts?

Serge Hallyn serge.hallyn at ubuntu.com
Tue Feb 11 15:44:35 UTC 2014


Quoting Adam Ryczkowski (adam.ryczkowski at statystyka.net):
> On Ubuntu, LXC has a nice feature, that allows to execute the script
> automatically upon boot, if the link to the configuration file is
> present on /etc/lxc/auto.
> 
> Unfortunately I need to call a mount-binding script on host before,
> so my container can see an external directory.
> 
> The script is simple:
> mount --bind /mnt/shared-folder /mnt/shared-folder
> mount --make-inbindable /mnt/shared-folder
> mount --make-shared /mnt/shared-folder

You can use 'lxc.hook.pre-mount' (see lxc.conf or lxc.container.conf
manpage for this), which is called in the container's mounts
namespace, but without the container rootfs set up.  You can
also use 'lxc.hook.mount', which is called later, after the
rootfs has been setup, but before it has done pivot_root, so you
stil have the host / available.

-serge


More information about the lxc-users mailing list