[Lxc-users] Automated Mount for every lxc container

bmullan bmullan.mail at gmail.com
Thu Apr 26 02:21:02 UTC 2012


Sebastian Bachmann <me at ...> writes:

> 
> 
> Hi,
> We are currently migrating from openvz to lxc and now we facing a
> problem which can be solved quickly but this would cause other trouble
> I'm trying to prevent.
> We had in all our VZ Containers a directory mounted from the host,
> which contains configs and shared stuff. This is now really mandatory
> for all containers, so it would be bad if we woudnt have it anymore.
> we solved the problem on the OpenVZ side with a common-mount script
> which gets the VZID from the config file and mounts the stuff into
> /var/lib/vz/root/$VZID/shared/folder
> 
> so we need the same thing for lxc... Otherwise we would have to put in
> the mount path into every lxc config file and for about 30 LXC's this
> would create a mess...
> 
> I found this Post on the mailinglist:
> http://www.mail-archive.com/lxc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f <at>
public.gmane.org/msg01204.html
> which says something about excactly what we would need. is this
> feature allready implemented? I couldnt find anything in the man page
> that it would...
> 
> with this feature we could write a common-config file which is
> included into every lxc config and could work, beside one fact: how
> does the common script know where to mount? Is is possible to use
> variables inside the config? so is the lxc.rootfs also a variable, i
> can use in my config?
> 
> thanks a lot, maybe someone has come up with a solution allready!
> 
> sebastian
> 


Sebastian...

First I need to warn you that I'm just learning LXC myself over the last 3
months but I've found alot of good information and I think if I understand what
you are asking.. that it can be done with bind.

Look at this web page's script and search for

"#configure shared directory in containers"

https://github.com/chmouel/my-lxc-setup/blob/master/install.sh

I've seen other examples and I know I've book-marked them but this was the first
I spotted so I figured I throw it out to you to see if it helps?

Brian






More information about the lxc-users mailing list