Interview Prep/Docker/Resource Limits, Health & Reliability

How do you diagnose an OOM-killed container?

IntermediateProductionResource Limits, Health & Reliability
Answer
docker inspect -f '{{.State.OOMKilled}} {{.State.ExitCode}}' web
dmesg -T | grep -i 'killed process'
docker stats --no-stream web

Check whether the app's heap exceeds the limit (JVM MaxRAMPercentage, Node --max-old-space-size, Go GOMEMLIMIT), then raise the limit or fix the leak. Note that page cache counts toward cgroup memory but is reclaimable.

All Docker questions Roadmap: Docker & containers

More on Resource Limits, Health & Reliability