`too many open files` inside a container.
BeginnerTroubleshootingResources, health checks, logging and restarts
Answer
Likely causes → Low nofile ulimit, FD leak, or host fs.file-max/inotify limits.
Diagnose →
docker exec c sh -c 'ulimit -n'
docker exec c ls /proc/1/fd | wc -l
sysctl fs.inotify.max_user_instances
Fix → --ulimit nofile=65536:65536; raise inotify sysctls on host for watchers (ENOSPC on inotify); fix leaks.
Prevent → Standard ulimits in daemon.json default-ulimits.
More on Resources, health checks, logging and restarts
Container restarts repeatedly: `docker ps` shows `Restarting (1) 5 seconds ago`.Beginner`OOMKilled: true` and exit code 137.BeginnerContainer is `unhealthy` but the app works when tested manually.Intermediate`docker stats` shows 100%+ CPU and the container is slow.Intermediate`docker logs` is slow or `docker logs -f` hangs on a container with huge logs.Intermediate`Error response from daemon: configured logging driver does not support reading` when running `docker logs`.Intermediate