Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I increase limits in my docker containers on CoreOS?

By default, CoreOS and the Linux kernel has some pretty conservative limits defined for things such as open files and locked memory.

So I upped the values in /etc/systemd/system.conf:

DefaultLimitNOFILE=500000
DefaultLimitMEMLOCK=unlimited

However, when I start my docker containers the limits are still low. ulimit -l prints 64.

Running ulimit -l unlimited prints an error.

ulimit: max locked memory: cannot modify limit: Operation not permitted

So I placed

LimitMAXLOCKED=unlimited
LimitNOFILE=64000

In my systemd unit file.

However, these values are not coming through to the docker container and calling them still doesn't work. I've rebooted the machine after changing the systemwide defaults.

This is probably more of a systemd thing. How do I fix this?

like image 776
hookenz Avatar asked Jan 23 '26 22:01

hookenz


1 Answers

Docker containers are not started nor managed by systemd. The Docker daemon is responsible for setting limits here. Here is an example taken from the official documentation:

# docker run --ulimit nofile=1024:1024 --rm debian sh -c "ulimit -n"
like image 148
Timothée Ravier Avatar answered Jan 26 '26 15:01

Timothée Ravier