From the docker host (CentOS 7) is possible to see that the open files limit is set to 1024.
# ulimit -a | grep open open files (-n) 1024
But the docker container has this limit set to 1048576
[root@e86ee2f0f6a0 /]# ulimit -a | grep open open files (-n) 1048576
Is it possible to change this value for the docker containers?
The open files limit is set by default to 1048576. This limit is not related to the host’s limit. There are 2 possible way how to change this limit:
global change (affects all containers)
1. In this case please modify the following lines in the /usr/lib/systemd/system/docker.service
# vi /usr/lib/systemd/system/docker.service LimitNOFILE=1048576 LimitNPROC=1048576
2. Reload daemon config and restart the docker service.
# systemctl daemon-reload # systemctl restart docker
Change specific container limit
In this case please run container with following option:
# docker run -it --ulimit nofile=122880:122880 centos
122880 is the hard and soft openfiles limit for the container “centos”.
Understanding /etc/security/limits.conf file