Journeys · Docker · L1

A container killed for using too much memory

No error message, no goodbye. The kernel ends it, and Docker writes down why.

✓ Validated on Docker Engine 29.9.3 · Docker Desktop (cgroup v2) · Run 2 · 2026-11-22Preview

The 30-second answer

--memory sets a limit on the container's cgroup. The program's memory grows until it reaches that limit. The kernel cannot reclaim enough, so it invokes the OOM killer inside that cgroup, which kills the process. The container's first process is gone, so the container stops. Docker records the exit code and OOMKilled in the container's state.

Mental model

A shared kitchen with a fridge shelf for each flatmate. Your shelf has a size. Keep adding food and, once the shelf is full, the landlord throws your food out. No discussion.

Where the analogy breaks

The landlord does not throw out the newest item: the kernel kills a process. And the note left behind is not on the shelf: Docker writes it into the container's state, where docker inspect reads it.

🔒 Free account

Sign up free to play this journey

A free account unlocks every scenario, journey and exam, and saves your progress. No payment, ever.