Docker exit code 137 (OOM) during build in CI
Exit 137 is 128 + 9, meaning SIGKILL. During a build it is almost always the out-of-memory killer terminating a RUN that exceeded available memory.
What this error means
A RUN step (often a bundler, compile, or test) exits with code 137 and frequently the single word Killed. There is no stack trace because SIGKILL cannot be caught.
docker
#12 137.4 Killed
ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 137Common causes
Build exceeded memory
Webpack/bundler builds, large compiles, and heavy test suites can spike past the runner memory ceiling, triggering the cgroup OOM killer.
Container memory limit too low
An explicit --memory or compose memory limit smaller than the build needs causes the same kill.
How to fix it
Give the build more memory
- Run on a larger runner, or raise/remove an explicit container memory limit.
- For Node, cap the heap below the limit with NODE_OPTIONS.
Dockerfile
ENV NODE_OPTIONS=--max-old-space-size=4096Reduce peak memory
- Lower build parallelism (make -j2, jest --maxWorkers=2).
- Split a monolithic build step into smaller ones.
How to prevent it
- Right-size runners for memory-heavy builds and set language heap limits relative to runner memory. Latchkey managed runners auto-retry a transient OOM and can place the job on a larger runner, so an occasional memory spike does not hard-fail the pipeline.
Related guides
Docker container "exited with code 137" (OOM) in CIFix a Docker container that "exited with code 137" at runtime in CI, caused by the out-of-memory killer termi…
Docker "no space left on device" during build in CIFix the Docker "no space left on device" build error in CI by reclaiming disk from accumulated layers and bui…
Docker "returned a non-zero code: 1" on a RUN step in CIFix the Docker "The command ... returned a non-zero code: 1" build error in CI, where a RUN instruction itsel…