A job running inside a container was killed because it crossed the container --memory limit. The cgroup OOM killer fires at the limit regardless of how much RAM the host has free.
What this error means
The container exits 137 / OOMKilled even though the host has free memory. Raising or removing the container --memory limit, or using a larger runner, clears it.
docker
$ docker inspect --format '{{.State.OOMKilled}}' job
true
##[error] The container exited with code 137 (OOMKilled).
Common causes
The container limit is below the job needs
A --memory/-m cap (or cgroup limit) smaller than peak usage triggers the cgroup OOM killer.
Multiple service containers sharing the limit
Service containers plus the job container together exceed the allotment.
How to fix it
Raise or remove the memory limit
Give the container enough headroom for peak usage.
docker
docker run -m 4g my-job
# in compose
services:
job:
mem_limit: 4g
Reduce usage or use a bigger runner
Lower in-container parallelism and heap sizes.
Split service containers across the available RAM.
Move to a runner with more memory.
How to prevent it
Set container limits with real headroom over peak usage.
Right-size runners for containerized jobs.
Check OOMKilled when a container exits 137.
Frequently asked questions
What causes "Container memory limit"?
A --memory/-m cap (or cgroup limit) smaller than peak usage triggers the cgroup OOM killer.
How do I fix Container memory limit?
Give the container enough headroom for peak usage.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.