[Lxc-users] Many containers and too many open files
Daniel Lezcano
daniel.lezcano at free.fr
Fri Feb 25 07:06:58 UTC 2011
On 02/25/2011 03:33 AM, Andre Nathan wrote:
> Hello
>
> My container setup uses read-only bind-mounts from the host's key
> directories (/bin, /sbin, /lib, /usr, parts of /etc and so on). It all
> works fine in single-container tests.
>
> Today I wrote a script that creates and starts a thousand containers,
> all using the scheme above with the bind-mounts. After about 40
> containers being started, I start getting "too many open files" errors
> and subsequent container start-up attempts fail.
You need to tweak your host in order to create a big number of containers.
> In the host, checking /proc/sys/fs/file-nr shows a number well below the
> configured maximum number of open files for the system, so it must be
> something related to the containers.
The first error could be related to:
/proc/sys/fs/inotify/max_user_instances
> My question is, how does ulimit work in the context of lxc? I noticed
> that despite increasing the limit in the shell before running lxc-start,
> the containers still showed a lower limit.
> Editing /etc/security/limits.conf didn't help either, so maybe I'm
> missing something on container startup?
>
> Also, is the limit really independently set per-container? If so, and if
> a single container works fine, why would this error occur with multiple
> containers?
>
I did exactly the same configuration and ran 1024 containers.
I hadn't to modify any ulimits for the container AFAIR, but just to
tweak /proc/sys limits.
More information about the lxc-users
mailing list