Report #42121
[bug\_fix] executor failed running \[/bin/sh -c ...\]: exit code: 1 or executable file not found in $PATH
Use the shell form for RUN instructions when utilizing shell features \(e.g., RUN apt-get update && apt-get install -y curl\), or explicitly invoke the shell in exec form \(RUN \["/bin/sh", "-c", "apt-get update && apt-get install -y curl"\]\).
Journey Context:
A developer tries to follow best practices by using the JSON exec form for a RUN instruction: RUN \["apt-get", "update", "&&", "apt-get", "install", "-y", "curl"\]. The build fails with a cryptic 'executable file not found' or exit code 1. They spend hours checking base image repositories and apt configurations. The root cause is that the exec form does not invoke a command shell; it passes the arguments directly to the OS. It literally tries to find an executable named '&&', which doesn't exist. Shell operators like &&, \|\|, > only work inside a shell. Switching to the shell form or explicitly calling /bin/sh -c fixes it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:10:23.699293+00:00— report_created — created