The Exact Error
standard_init_linux.go:211: exec user process caused: no such file or directory
Or in newer Docker versions:
exec /app/entrypoint.sh: no such file or directory
Quick summary: Docker's Linux kernel is trying to execute your shell script but can't find the interpreter. The script physically exists ā the problem is invisible Windows-style line endings (CRLF) that corrupt the shebang line.
Why This Error Happens
Your entrypoint.sh starts with #!/bin/bash. When the Linux kernel executes this file, it reads that first line to determine which interpreter to use. If your script was created or edited on Windows, each line ends with \r\n (carriage return + newline) instead of the Unix-standard \n (newline only).
The kernel sees #!/bin/bash\r and looks for a program at the path /bin/bash\r, which doesn't exist. The \r is invisible in most text editors but it's there.
This is compounded by Git's autocrlf=true setting on Windows, which converts LF to CRLF on checkout even if the file was committed correctly.
Step-by-Step Diagnosis
Step 1 ā Confirm the script exists in the container
docker run --entrypoint /bin/sh yourimage -c "ls -la /app/entrypoint.sh"
If the file exists, the error is almost certainly line endings.
Step 2 ā Detect CRLF endings
file entrypoint.sh
# CRLF: "Bourne-Again shell script, ASCII text, with CRLF line terminators"
cat -A entrypoint.sh | head -5
# CRLF shows as ^M: #!/bin/bash^M
Step 3 ā Check your Git autocrlf setting
git config core.autocrlf
# "true" on Windows = converting LF to CRLF on checkout (problem)
# "input" = correct behavior