I’m working on getting an Azure DevOps build agent running in a docker container. An error I got while trying to get this done was the following:
exec ./start.sh: no such file or directory
Here is the corresponding (simplified) docker file:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 | |
#Removed part of the file | |
COPY ./start.sh . | |
RUN chmod +x start.sh | |
ENTRYPOINT [ "./start.sh" ] |
Nothing special...
Where is the fault?
The problem turns out to be the start.sh file itself. I originally created it using Notepad what resulted in Windows-style line endings(CRLF). Instead this should be Linux-style line endings(LF).
There are multiple tools out there that supports this (like Notepad++) but you can also do this through VSCode. At the bottom of the editor you can find the currently used line endings style.
If you click on it you can change it: