[Lxc-users] Creating multiple containers simultaneously

Roberto Aloi prof3ta at gmail.com
Mon Nov 28 17:40:36 UTC 2011


Hi,

I'm currently dealing with a pool of LXC containers which I use for
sand-boxing purposes. Sometimes, when re-creating one of the
containers in the pool I obtain the following error:

Error: "CREATE CONTAINER container-5\ndebootstrap is
/usr/sbin/debootstrap\nCache repository is busy.\nfailed to install
ubuntu natty ...

My interpretation of the problem is that rebooting several containers
at the same time can be problematic - e.g. because they are trying to
access the cache repository at the same time -. Assuming my
interpretation is correct, is there a way to create multiple
containers at the same time?

Also, the creation time for the first container is pretty high (~8
minutes), because it seems to download all required packages. After
that, once the packages are cached, creating a new container is a much
faster process (~30 sec). Still, that's quite a lot of time. I'm
wondering if there is a way to lower this creation time even further.
The reason I have a pool of LXC containers and I re-create them
continuously is that I need the containers to run untrusted code,
coming in the form of "jobs". This code can potentially have
destructive effects on the containers, making them unusable for
further job processing, which is the reason why I re-create the
containers after each job submission. What I would love to do is to
setup a "base" container which contains the OS and the required
packages (the common part) and to create several - customizable -
instances of this container. When I say "customizable" I mean that I
should be able to specify a port number which a server running inside
one of the containers should listen to and this number should be
different per each container. Would this be feasible via LXC? Any
suggestion on how to achieve this?

Cheers,

Roberto Aloi
---
Twitter: @robertoaloi




More information about the lxc-users mailing list