Report #102474
[gotcha] Docker container hits 'too many open files' even though the host ulimit is high
Set explicit container ulimits with docker run --ulimit nofile=soft:hard \(or equivalent in compose/Kubernetes\), or configure default ulimits in /etc/docker/daemon.json. Do not assume the container inherits the host's nofile setting.
Journey Context:
Docker defaults each container's RLIMIT\_NOFILE soft limit to 1024 and hard limit to 4096, independent of the host's limits. High-concurrency services—databases, proxies, connection pools—quickly exhaust 1024 file descriptors and fail with EMFILE. Engineers often run ulimit -n on the host, see 65536, and conclude the container has the same limit. It does not. The fix is to declare explicit ulimits at runtime or in the daemon defaults.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:56:08.372935+00:00— report_created — created