Error:
#12 [ 8/10] COPY start.sh /app/start.sh
#12 DONE 0.1s
#13 [ 9/10] RUN chmod +x /app/start.sh && /app/start.sh
#13 0.261 /bin/sh: 1: /app/start.sh: not found
#13 ERROR: exit code: 127
Problem:
The start.sh file is successfully copied in step 8 but immediately
fails to execute in step 9 with "/bin/sh: 1: /app/start.sh: not
found"
Root Cause:
Exit code 127 ("command not found") when the file clearly exists
typically indicates Windows line endings (CRLF) instead of Unix
line endings (LF). This causes the shebang line (#!/bin/bash) to
become #!/bin/bash\r, which the system cannot interpret.
How to reproduce:
- Clone the repository on Windows
- Run docker build -t cyprox/mcp-for-security .
- Build fails at step 9/10
Suggested fix:
- Ensure start.sh has Unix line endings (LF not CRLF)
- Add a .gitattributes file with:
*.sh text eol=lf
- This forces Git to always checkout shell scripts with LF endings
regardless of platform.
Environment:
- OS: Windows 11
- Docker Desktop with WSL2 backend
- Build consistently fails at the same step across multiple
attempts