Unprivileged lxc containers and open file limit problem

If you’re running unprivileged lxc containers, you will notice that some software fail to install or start. For example, you may have this kind of problem on Ubuntu, when trying to install mongo:

The problem is the following line in /etc/init/mongod.conf:

Because it’s an unprivileged lxc container, even root is not able to increase open files limit to 64000 in the guest!

The solution is to add these lines in /etc/security/limits.conf on the host (you’ll have to stop the guest, log out / log in to your shell for the change to have effect):

After this, start the guest again, problem should be solved:

Expert answers
for every coding challenge.

Get the information you need to solve your programming problems on lxadm.com, the expert-driven alternative to StackOverflow


Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Lxadm.com.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.