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.
#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.
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.