[lxc-users] LXC, unionfs and short lived containers

Serge E. Hallyn serge at hallyn.com
Sun Jan 29 16:36:46 UTC 2017


On Sun, Jan 29, 2017 at 04:49:22AM +0700, Fajar A. Nugraha wrote:
> On Sun, Jan 29, 2017 at 4:04 AM, Frans Meulenbroeks <
> fransmeulenbroeks at gmail.com> wrote:
> 
> > Hi,
> >
> > I'm working on migrating from LXC 1.x to LXC 2.
> > While doing so I bumped upon the following issue:
> >
> > My containers are short-lived (say an hour or so).
> > In LXC 1 we used an overlay filesystem in order to speed up the lxc create.
> > However I understood LXC 2 does not have this capability.
> >
> 
> 
> Where did you read that?
> 
> 
> > Any idea how to create containers quickly and efficiently in LXC 2
> >
> > Complication is that at some times we have a fair amount of containers
> > alive (say around 50), so creating all containers and reverting to a
> > snapshot is probably not efficient
> >
> 
> Why is it not efficient?
> 
> 
> > (apart from the space taken up by the 50 rootfs-es).
> >
> > Thanks in advance for any suggestions how to tacke this!
> >
> 
> 
> I'm pretty sure you can still use overlayfs with lxc-2.
> 
> My suggestion though, is go with lxd and zfs instead. You can have a

Agreed, either zfs or btrfs would work great.  And would avoid the known
issues which overlayfs has (i.e. inotify breakage)

> "golden" container, keep it stopped, and simply create your other
> containers with "lxc copy". With zfs, the "copy" process will be instaneus,

lxc copy would work, or you can also create a local published image of
your golden container,

lxc publish mygolden --alias=goldenimage

then launch containers fromthat image

for i in `seq 1 10`; do
	lxc launch goldenimage c${i}
done


> and the "clone" will be its own filesystem (no lower/base directory
> restriction like in aufs/overlayfs).
> 
> If you need to modify the "golden" container (which will affect all NEW
> containers copied from it), simply start it and perform-your-changes like
> on a normal container (don't forget to stop it afterwards). Note that this
> is different from aufs/overlayfs, where generally you shouldn't touch the
> lower/base directory.
> 
> -- 
> Fajar

> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users



More information about the lxc-users mailing list