Docker Container Exited Code 137: How to Diagnose and Fix It
Exit code 137 means the container received SIGKILL (128 + 9). Nine times out of ten that's the kernel OOM-killer reclaiming memory — either the container hit its limit, or the host ran out. Here's how to tell which.
Step 1 — Confirm it was OOMKilled
docker inspect <container> --format '{{.State.OOMKilled}}'
If this returns true, the kernel killed it for exceeding a memory limit. Cross-check the host's kernel log:
dmesg -T | grep -i -E 'killed process|out of memory'
Step 2 — Container limit or host pressure?
- Container hit its own limit: the container has a
--memorylimit and its working set exceeded it.docker stats <container>shows usage vs limit climbing to 100%. - Host out of memory: no per-container limit, but the host ran out and the kernel killed the biggest offender.
free -hand the dmesg line tell you.
If OOMKilled is false, exit 137 instead means something sent SIGKILL — commonly a docker stop whose grace period expired (the app didn't shut down in time and was force-killed).
Step 3 — The fixes
- Raise the limit if the workload legitimately needs more:
docker run --memory=1g …(or the Composemem_limit). - Fix the leak if usage grows unbounded — that's an application bug, not a sizing problem.
- Add host memory / swap if the host itself is over-committed.
- Increase the stop grace period (
docker stop -t 30) if the container is being force-killed during shutdown.
How Tech Matrix solves this in ~60 seconds
Exit 137 is terse, and confirming OOM means cross-checking inspect, docker stats and dmesg. Tech Matrix reads them on your host via a secure agent, tells you whether it was the container limit, a leak, or host pressure, and gives the exact fix — grounded in your Docker and kernel versions, with your approval.
Frequently asked questions
It means the container received SIGKILL (128 + 9). Most often the kernel OOM-killer terminated it for exceeding a memory limit; sometimes it's a docker stop that timed out and force-killed the process.
Run 'docker inspect
Raise its --memory limit if the workload needs it, fix the memory leak if usage grows unbounded, or add host memory/swap if the host is over-committed.