[Lxc-users] Using common rootfs for multiple containers

Vallevand, Mark K Mark.Vallevand at UNISYS.com
Tue Jul 9 12:56:24 UTC 2013


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.Vallevand at Unisys.com<mailto:Mark.Vallevand at 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.adapa at gmail.com]
Sent: Monday, July 08, 2013 11:23 PM
To: Lxc-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130709/7d0e2000/attachment.html>


More information about the lxc-users mailing list