failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: 1
A RUN step in your Dockerfile failed. The real error is printed in the lines just above this message.
Seen on:
Docker
Meaning
BuildKit stops at the first RUN command that exits non-zero and reports it with this generic line (the legacy builder says “The command '/bin/sh -c …' returned a non-zero code”). Scroll up for the actual failure: npm/pip errors, missing packages, network/DNS, or out-of-memory (exit code 137).
Common causes
- The command itself failed (npm install, pip install, make)
- apt/apk package not found (missing apt-get update)
- No network/DNS during build
- Build runs out of memory (exit code 137)
- Command assumes a file not copied yet
⚡ Quick fix
- Read the log above the error, or rebuild with --progress=plain --no-cache
- Run the failing command in an interactive container from the previous stage
- Combine apt-get update && apt-get install in one RUN
Detailed fix by platform
Docker
docker build --progress=plain --no-cache -t app . 2>&1 | tail -60
Dockerfile
- bash
RUN apt-get update && apt-get install -y --no-install-recommends curl \\ && rm -rf /var/lib/apt/lists/*
How to diagnose
- Real error — Lines just before "did not complete successfully"
- Exit code — 1 (command), 127 (not found), 137 (OOM)
- Reproduce — docker run -it <base> sh and run the step
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Docker
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026