Exit code 137: the container that ran out of memory
Memory limits, the OOM killer, and why the host looked fine
A container that dies with no error in its own logs was often killed from outside. Its memory limit is separate from the machine's.
A service restarts at random. Its logs end mid-sentence, no exception, no shutdown message. The server it runs on has plenty of free memory. The exit code is 137.
What 137 means
Exit codes above 128 mean "killed by a signal", and the signal number is the code minus 128. 137 is 128 plus 9: signal 9, SIGKILL. A process cannot catch or log it, which is why the logs stop without a word.
Two different limits
The machine has its own memory, and a container can have a smaller limit set on top. The kernel enforces the limit per group of processes. When the group goes over, the kernel's out-of-memory killer picks a process in it and ends it, even though the host as a whole is nowhere near full.
Finding it
Ask the container runtime or the orchestrator for the last state of the container. It records the reason, often shown as OOMKilled, and the kernel log has a line naming the process and the limit that was hit. Compare memory use over time with the limit: a steady climb is a leak, a sudden spike is a large request or batch.
Not everything counted is yours
File cache and buffers may count towards the group's usage. The kernel will usually reclaim them under pressure, so a high number is not always a problem, but a limit set too tightly around the working set can cause trouble.
What to do
Raise the limit if the usage is honest, fix the leak or bound the batch size if it is not, and set a request that matches the real need so the scheduler places the container sensibly. Runtimes with their own heap, such as the JVM or Node, need a heap size that sits below the container limit with room to spare.