Skip to content
Latchkey

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: 137

Common 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

  1. Run on a larger runner, or raise/remove an explicit container memory limit.
  2. For Node, cap the heap below the limit with NODE_OPTIONS.
Dockerfile
ENV NODE_OPTIONS=--max-old-space-size=4096

Reduce peak memory

  1. Lower build parallelism (make -j2, jest --maxWorkers=2).
  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.

Frequently asked questions

What causes ""exit code: 137" (OOM)"?
Webpack/bundler builds, large compiles, and heavy test suites can spike past the runner memory ceiling, triggering the cgroup OOM killer.
How do I fix "exit code: 137" (OOM)?
Give the build more memory

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card