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

Frans Meulenbroeks fransmeulenbroeks at gmail.com
Sun Jan 29 12:25:55 UTC 2017


Hi Fajar, all,

Thanks for your reply.

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?

Here: https://github.com/lxc/lxd/issues/1878 see the response of Stephane.
Of course this reply is almost 10 months old.


> 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?

I'm worried about disk storage and creation time, but I noticed your
suggestion below.


> (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
"golden" container, keep it stopped, and simply create your other
containers with "lxc copy". With zfs, the "copy" process will be instaneus,
and the "clone" will be its own filesystem (no lower/base directory
restriction like in aufs/overlayfs).

Ah ok, currently we already have a golden container from which we derive
new containers using aufs.
I've just tried the above and it works like a charm!

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.

Yeah I am aware of the latter. We always have to take care in lxc-1 when
updating the golden container that no instances were running.

This is great info! Thanks again!
Frans

--
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170129/cc23d6b7/attachment.html>


More information about the lxc-users mailing list