Container killed by OOM killer (SIGKILL)
Exit code 137 is not a direct application error, but rather a signal from the host's kernel that the process was forcefully terminated. It is calculated as 128 + 9 (SIGKILL). In the context of Docker, this almost always means the container exceeded its memory limit and was killed by the OOM (Out Of Memory) killer.
- 1Container memory limit ('--memory') is set too low for the application.
- 2The application inside the container has a memory leak.
- 3The host machine is out of memory, forcing the kernel to reclaim memory by killing processes.
- 4A batch job or data processing task unexpectedly requires a large amount of memory.
Running a Java application with a small heap size inside a container with a tight memory limit, causing the JVM to request more memory than is available.
# Run a container with a low memory limit docker run --memory=128m -d my-java-app # The application inside attempts to use more than 128MB of RAM # Check the exit code after it stops docker wait my-java-app-container-name
expected output
137
Fix 1
Increase Container Memory
WHEN The application's memory requirements are known and have grown.
# Increase memory limit to a more reasonable value docker run --memory=512m my-java-app
Why this works
Provides more RAM to the container, preventing the OOM killer from being triggered for normal workload.
Fix 2
Inspect Container for OOMKilled State
WHEN You suspect an OOM event but need confirmation.
docker inspect <container_id> --format '{{.State.OOMKilled}}'Why this works
The Docker daemon records if a container was terminated by the OOM killer. This command confirms the root cause of the Exit 137.
✕ Assume Exit 137 is always a memory leak.
While a leak is a common cause, it can also be triggered by legitimate, high-memory workloads or misconfigured limits. Always investigate before assuming.
✕ Disable the OOM killer on the host.
This is extremely dangerous. If the system runs out of memory and cannot kill any process, it will likely lead to a kernel panic and a full system crash.
Stack Overflow: What does exit code 137 mean for a Docker container?
Understanding and Troubleshooting Exit Code 137 ↗Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev