buildx "failed to solve: process ... did not complete successfully: exit code: 1" in CI
BuildKit ran a RUN instruction and the shell command inside it returned a non-zero status, so BuildKit aborts the build. The real failure is in the command output printed above this summary line, not in the summary itself.
What this error means
The build stops with "ERROR: failed to solve: process \"/bin/sh -c <command>\" did not complete successfully: exit code: 1". The named command is the RUN step that failed.
#12 ERROR: process "/bin/sh -c apt-get install -y libpq-dev" did not complete successfully: exit code: 1
------
ERROR: failed to solve: process "/bin/sh -c apt-get install -y libpq-dev" did not complete successfully: exit code: 1Common causes
A command inside RUN returned non-zero
A package install, compile, or test invoked by the RUN step failed. BuildKit reports the exit code but the cause is in the step output above.
A missing dependency or stale package index
An apt-get install without a preceding apt-get update, or a package no longer in the index, makes the RUN command exit 1.
How to fix it
Read the failing RUN output above the summary
- Scroll up to the
#<n> ERRORline that names the same command. - Read the actual error the command printed (missing package, compile failure).
- Fix the command or its prerequisites in the Dockerfile.
Update the index before installing
Combine update and install in one RUN so the package index is fresh when the install runs.
RUN apt-get update && apt-get install -y --no-install-recommends libpq-dev \
&& rm -rf /var/lib/apt/lists/*How to prevent it
- Run the same build locally to surface the RUN failure before pushing.
- Combine
apt-get updatewith installs in a single RUN. - Use
set -euxin shell scripts so the failing line is visible.