Report #70399
[gotcha] Containers inherit host ulimits causing 'too many open files' errors despite high host limits
Explicitly set ulimits in container orchestration config \(ECS task definition, K8s securityContext, Docker Compose\) rather than relying on daemon defaults
Journey Context:
Developers migrating from VMs to containers often assume the container sees the host's /etc/security/limits.conf \(e.g., 65535 open files\). However, Docker and containerd by default copy the ulimit values from the daemon process, which may be 1024:4096 or inherited from systemd. This causes production crashes under load with 'EMFILE' errors that don't reproduce on developer laptops \(which often have higher defaults\). The trap is assuming 'nofile' is unlimited inside containers. Alternatives like modifying the host daemon.json affect all containers and violate least privilege. The correct approach is declarative ulimits in the workload spec \(e.g., ECS Ulimit parameter, Kubernetes limits.hard.nofile\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:45:05.657450+00:00— report_created — created