Interview Prep/Docker/Build failures and cache problems

`The command '/bin/sh -c ./gradlew build' returned a non-zero code: 126`

IntermediateTroubleshootingBuild failures and cache problems
Answer

Likely causes → Script lacks execute bit (common when copied from Windows), or CRLF line endings (/bin/sh^M: bad interpreter).

Diagnose → ls -l gradlew; file gradlew; head -1 gradlew | od -c.

Fix → chmod +x gradlew (or COPY --chmod=755), dos2unix, set .gitattributes * text=auto eol=lf for shell scripts.

Prevent → .gitattributes for *.sh text eol=lf.

All Docker questions Roadmap: Docker & containers

More on Build failures and cache problems