
Docker Out of Memory: How to Diagnose and Fix OOM Kills
Docker Out of Memory: How to Diagnose and Fix OOM Kills Your container keeps dying and you don't know why. No error in the app. No crash message. Just — gone. Nine times out of ten, the kernel killed it for using too much memory. Here's how to know for sure and fix it. Confirm It's an OOM Kill # Check the container's last exit code docker inspect <container_name> | grep -A 5 '"State"' An OOM kill shows "OOMKilled": true : "State" : { "Status" : "exited" , "Running" : false , "OOMKilled" : true , "ExitCode" : 137 } Exit code 137 = killed by signal. Combined with OOMKilled: true = out of memory. Also check kernel logs: sudo dmesg | grep -i "oom \| killed process" | tail -20 You'll see something like: Out of memory: Kill process 12345 (node) score 847 or sacrifice child Killed process 12345 (node) total-vm:2048000kB, anon-rss:1834000kB Check Current Memory Usage # Live container stats docker stats --no-stream # Check if a memory limit is set docker inspect <container_name> | grep -i memor
Continue reading on Dev.to
Opens in a new tab




