Interview Prep/Docker/Limits, logging, health checks and restarts

Prevent a fork bomb in a container.

IntermediateScenarioLimits, logging, health checks and restarts
Answer

Situation read → Unbounded PIDs can exhaust the host process table.

What I'd do → docker run --pids-limit 256 ... and a daemon default via "default-pids-limit" where supported. Add --ulimit nofile=65536:65536 for file descriptors.

Why → The pids cgroup controller stops fork calls beyond the limit.

Interview tip → Test with :(){ :|:& };: in a sandbox.

All Docker questions Roadmap: Docker & containers

More on Limits, logging, health checks and restarts