Skip to content
Latchkey

Docker "process did not complete successfully: exit code: 1" - Fix Failing RUN Steps

BuildKit ran a RUN step and the shell command inside it exited non-zero. The build is reporting your command failed - the real error is in the step output just above this line.

What this error means

A docker build aborts on a RUN step with process "/bin/sh -c ..." did not complete successfully: exit code: 1 (or another non-zero code). The wrapper names the failing command; the actual error is in the lines printed above it.

docker build output
#9 12.84 npm ERR! missing script: bulid
#9 ERROR: process "/bin/sh -c npm run bulid" did not complete successfully: exit code: 1
------
ERROR: failed to solve: process "/bin/sh -c npm run bulid" did not complete successfully: exit code: 1

Common causes

The command inside RUN genuinely failed

A compile error, a failing test, a missing script, or a bad flag makes the command exit non-zero. BuildKit faithfully fails the build because a non-zero RUN is, by design, a build failure.

A piped command masks then unmasks the failure

In a pipeline like curl ... | sh, only the last command’s exit code counts unless pipefail is set - so a failure can appear in a confusing place once you enable strict mode.

A dependency the command needs is missing

The command runs but a tool, file, or environment variable it depends on is absent in that layer, so it exits with an error code rather than crashing outright.

How to fix it

Read the step output above the wrapper line

  1. The did not complete successfully line only names the command - scroll up to the actual error it printed.
  2. Re-run with --progress=plain so the full command output is visible, not collapsed.
  3. Fix the underlying command (typo, missing script, failing test) just as you would outside Docker.

Get full, uncollapsed logs

Plain progress output shows every line the failing command produced.

Terminal / Dockerfile
docker build --progress=plain --no-cache .
# make pipelines fail on the right command:
RUN set -eo pipefail && curl -fsSL https://example.com/install.sh | sh

How to prevent it

  • Use set -euo pipefail in non-trivial RUN shell blocks so failures surface immediately.
  • Keep one logical action per RUN where practical so the failing step is obvious.
  • Reproduce the failing command locally in the same base image before debugging in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →