5.18 Override default ulimit at runtime only if needed

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.

See Also

https://workbench.cisecurity.org/files/1476

Item Details

Category: SYSTEM AND COMMUNICATIONS PROTECTION

References: 800-53|SC-6

Plugin: Unix

Control ID: eff6e968eed029420fa3fd0f126556946547693a64628aac6396756d9f076e60