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

Container killed by the OOM killer but `docker stats` never showed high memory.

AdvancedTroubleshootingResources, health checks, logging and restarts
Answer

Likely causes → Short spikes between sampling intervals, kernel memory/tmpfs counted in the cgroup, or sub-process memory.

Diagnose →

cat /sys/fs/cgroup/system.slice/docker-<id>.scope/memory.events
cat .../memory.peak
dmesg -T | grep -B2 -A10 'Memory cgroup out of memory'

Fix → Raise the limit by the observed memory.peak, reduce spikes (batch size, parallelism).

Prevent → Alert on memory.events oom_kill counters.

All Docker questions Roadmap: Docker & containers

More on Resources, health checks, logging and restarts