[Lxc-users] Using common rootfs for multiple containers
Walter
walter.stanish+lxc-users at gmail.com
Tue Jul 9 06:41:02 UTC 2013
Yes, this is possible.
There are multiple approaches, for example:
1. Creating a snapshot (or outright copy) of a filesystem, then
disposing of it when done.
(1a) Manually creating a full copy
(1b) Using a blockstore-provided snapshot facility such as LVM2
2. Using a snapshot-capable filesystem, and using a snapshot provided
by the filesystem itself (ZFS, BTRFS, etc.)
3. Mounting read-only, with either of two solutions for writable
portions of the filesystem. This class of solution is very similar to
NFS based root situations (ie. modern PXE-driven diskless network
boot).
(3a) 'tmpfs' or some other in-memory based write solution where required.
(3b) Union-mounts.
My advice would be as follows.
== simplest ==
(1a) and (1b) are easiest *and* allow the use of arbitrary filesystems.
== medium hassle==
(2) is become somewhat common but is more difficult.
(3b) are more difficult
== more hassle ==
(3a) is more hassle up front but is perhaps the neatest solution overall.
(3b) i have never got working, but should be neat.. it's just not
going to be as widely supported by various kernels out there as (3a)
or (1b).
Personally I use (3a) and (1b).
- Walter
More information about the lxc-users
mailing list