Yes, it's possible.  We do it.  I can't share the code, but I can describe it.

We create a master container using standard lxc-create script with our own 
template and config file.  The template is based on the ubuntu template.  The 
master container is never started.  All subsequent containers share the rootfs 
of the master container.

We use the lxc library to read the master container's config, then fork and 
call lxc_start to run a program in a new container using the config we read.  
But, you should be able to do this with scripts, if that is your choice.

A couple of warnings.  You need to create an empty directory in /var/lib/lxc 
for each container that matches the name specified in the lxc_start call.  You 
must create the containers serially.  This technique will fail if lxc-create is 
called concurrently by different threads or processes.

We are using Ubuntu 12.04 LTS 64-bit.

Regards.
Mark K Vallevand   mark.vallev...@unisys.com<mailto:mark.vallev...@unisys.com>
May you live in interesting times, may you come to the attention of important 
people and may all your wishes come true.
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

From: Ajith Adapa [mailto:ajith.ad...@gmail.com]
Sent: Monday, July 08, 2013 11:23 PM
To: Lxc-users@lists.sourceforge.net
Subject: [Lxc-users] Using common rootfs for multiple containers

Hi,
I would like it know is it possible to create a single rootfs (might be in 
read-only mode) and share it among multiple containers ?
Currently for every container we create its own unique rootfs.
What would be the best place to look in code for using single rootfs across 
multiple containers.

Regards,
Ajith
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users

Reply via email to