Skip to content

Issue: Docker build fails at step 9/10 - start.sh not found despite successful copy #12

@iamtyroon

Description

@iamtyroon

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:

  1. Clone the repository on Windows
  2. Run docker build -t cyprox/mcp-for-security .
  3. Build fails at step 9/10

Suggested fix:

  1. Ensure start.sh has Unix line endings (LF not CRLF)
  2. Add a .gitattributes file with:
    *.sh text eol=lf
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions