Report #104629
[bug\_fix] failed to solve: failed to compute cache key: "/bin/sh" not found: not found
Use \`RUN \["executable", "param"\]\` \(exec form\) instead of \`RUN command\` \(shell form\) when the base image does not have \`/bin/sh\` \(e.g., scratch or distroless images\). The root cause is that the shell form \(\`RUN command\`\) invokes \`/bin/sh -c\`, but the base image may not include a shell. The fix is to use the exec form to directly execute the binary without a shell. This is a common mistake when using minimal base images.
Journey Context:
A developer was building a minimal image from \`scratch\` and had a Dockerfile with \`RUN echo hello\`. The build failed with 'cache key: /bin/sh not found' because \`scratch\` has no shell. They had previously used \`alpine\` which includes \`/bin/sh\`, so they didn't realize the difference. After reading the Dockerfile reference, they changed to \`RUN \["/bin/echo", "hello"\]\` \(exec form\) and it worked. This is a classic gotcha when switching to scratch or distroless images.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-13T20:07:11.702555+00:00— report_created — created