OOM killer

When a container goes over its memory limit, or the server runs out of memory, the kernel's OOM killer kills a process to free memory. The container exits with code 137.

How it works

docker inspect -f '{{.State.OOMKilled}}' tells whether the container hit its own limit. Without limits, a leaking container grows until the whole server is short of memory, and the kernel may kill another process instead, often the database.

What breaks

A restart policy turns a memory leak into a series of short outages: killed, restarted, killed again. Limits keep the damage inside one service; fixing the leak or sizing the limit is still your job.

In a terminal

docker inspect -f '{{.State.ExitCode}} {{.State.OOMKilled}}' api
docker stats --no-stream

See it break, then fix it

Write the Dockerfile or the compose file, type the docker commands, and watch a simulated server run them through reboots, upgrades and traffic. Free to start.