Skip to content

Conversation

@billxc
Copy link

@billxc billxc commented Oct 28, 2025

What issue this PR fixes

This PR resolves a Docker entrypoint error that occurs when building and running the container on Windows. The error is caused by Windows-style (CRLF) line endings in entrypoint.sh, which prevent the shell from executing the script correctly in the Linux-based container.

How to reproduce the issue

  1. Clone the repository on a Windows machine.
  2. Build the Docker image:
    docker build -t copilot-api .
  3. Run the container:
    docker run copilot-api
  4. You will see an error similar to:
    exec /entrypoint.sh: no such file or directory
    

Root cause

When shell scripts are created or edited on Windows, they default to CRLF (Carriage Return + Line Feed, \r\n) line endings. When the shebang line #!/bin/sh contains a \r character, the Linux kernel interprets it as part of the interpreter path (/bin/sh\r), which doesn't exist. This causes the "no such file or directory" error even though the file itself is present in the container.

Solution

This PR adds a .gitattributes file to enforce LF line endings for shell scripts, ensuring compatibility with Docker on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant