Linux & servers
What does OOMKilled mean for a Docker container?
Short answer
OOMKilled means a container process was killed because of an out-of-memory condition. Investigate both the container’s memory limit and pressure on the host before deciding to add RAM.
What changes the answer
- The container memory limit
- Memory use across the whole server
- Which task was running when the container stopped
Confirm what stopped the container
Check the container's state with Docker inspect and look at the OOMKilled value. An exit code of 137 alone is not enough to diagnose an out-of-memory event; a process can receive a forced termination signal for other reasons.
Match the stop time with application logs and the host's system logs. A failure during an import suggests a different investigation from a service that slowly grows over several days.
Check the limit and the host separately
A container can hit its configured memory limit while the VPS still has spare RAM. Conversely, a host under memory pressure can lose processes even when an individual container does not have a restrictive limit.
Review memory use across the database, web workers, background jobs and other containers. Leave room for the operating system. Raising every limit without checking the total can move the problem from one application to the whole server.
Choose a fix that fits the workload
If several jobs start together, reduce concurrency or process smaller batches. If memory keeps growing without falling between jobs, investigate retained data or a leak. If normal, measured usage consistently exceeds the allocation, increase capacity or adjust the limit within the host's budget.
A restart policy can bring a service back, but repeated restarts may interrupt the same job again and again. Check whether partial work can be retried safely before treating automatic restarts as the solution.
Swap can provide a buffer in some setups, with a performance cost. It does not turn a server with too little RAM into a reliable fit for a sustained workload. After making a change, watch the same operation that triggered the failure and check memory across the server, not just whether the container stays running for a few minutes.