Report #16917
[bug\_fix] executor failed running \[/bin/sh -c ...\]: executable file not found in $PATH
Use a base image with a shell for the build stage, or avoid RUN instructions in the final scratch/distroless stage; instead, perform all filesystem modifications in the builder stage and copy the results.
Journey Context:
A developer creates a multi-stage Dockerfile, compiling a Go binary in a golang stage and copying it to a scratch stage. They attempt to add a non-root user by running RUN useradd appuser or RUN chmod \+x /app in the final stage. BuildKit throws an executor error. They debug by checking the binary architecture and PATH, then realize scratch has absolutely nothing, not even /bin/sh required by the shell form of RUN. The fix is to do all filesystem modifications \(like creating users or setting permissions\) in the builder stage and COPY --from=builder /etc/passwd /etc/passwd, etc. This works because the builder stage has the necessary shell and utilities, and scratch only receives the final static files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:56:47.112212+00:00— report_created — created