Information
The default ulimit is set at the Docker daemon level. However, you may override the default ulimit setting, if needed, during container runtime.
Rationale:
ulimit provides control over the resources available to the shell and to processes started by it. Setting system resource limits judiciously saves you from many disasters such as a fork bomb. Sometimes, even friendly users and legitimate processes can overuse system resources and in-turn can make the system unusable.
The default ulimit set at the Docker daemon level should be honored. If the default ulimit settings are not appropriate for a particular container instance, you may override them as an exception. But, do not make this a practice. If most of the container instances are overriding default ulimit settings, consider changing the default ulimit settings to something that is appropriate for your needs.
Solution
Only override the default ulimit settings if needed.
For example, to override default ulimit settings start a container as below:
docker run --ulimit nofile=1024:1024 --interactive --tty centos /bin/bash
Impact:
If the ulimits are not set properly, the desired resource control might not be achieved and might even make the system unusable.
Default Value:
Container instances inherit the default ulimit settings set at the Docker daemon level.