Container wont work: file not found

Hi

Background:
I’m slowly getting into building images myself. So I did not start from scratch but wanted to make some adjustments to existing dockerfiles which would be preferrable for my usecase.

Working
When i pulled osticket by campbell software solutions and set it up with a mariadb in docker-compose and it works.

Not Working
When I then pull the repository from GitHub build it on my windows machine (no changes to dockerfile, no errors while building) push it to docker hub and then pull it from there on my server (identical docker-compose just “my” image instead of the “original” one) it gives me /usr/local/bin/docker-php-entrypoint: exec: line 9: /data/bin/start.sh: not found.

Any ideas what goes wrong?

I also tried to up the osticket version in the docker file - of course with the exact same error (posted here now answer yet).

Thank you in advance for your support!!

Hi

Its hard to tell when we are not giving the dockerfile you’re having issues with, you gave us the url to a github which works.

Maybe try and run it “docker -ti IMAGENAME bash” and see if the files are in that directory

It happens when you pull a git project on windows with settings to convert line endings in shell scripts beginning with the shebang line.
The error message in this case doesn’t say that the start.sh does not exist. It actually tries to run it but the shebang line tells the shell which program should execute the content when you run the script directly.

./script.sh

becomes

/bin/bash script.sh

In your case the shebang line is #!/bin/bash\r\n where \r (carriage return) and \n (new line) are the visible representations of the non-printable characters. So the entrypoint tries to execute this:

/bin/bash\r /data/bin/start.sh

Any invalid command in the shebang line would have the same result.

This is where I shared how I configured git on Windows to avoid this issue:

Thanks a lot for your reply. I did not apply your solution, but you pointed me in the right direction.

In a nutshell: I built the image in Ubuntu 20.04 App in Windows and it works.

In steps:

  1. I set up Ubuntu 20.04 App on Windows making sure WSL2 is installed (was missing).
  2. Pulled repo from github in CLI
  3. Changed Dockerfile in nano
  4. Build image

After correctly setting up WSL2 in Ubuntu and configuring Docker Desktop I did not try to compile it again in cmder where I usualy work.

One can still pull repositories in Windows edit in e.g. in VSCode upload it and download it in the Ubuntu App in Windows. I know, I know there is a better way - its just a work around if you don’t want to fumble with configuration in Windows.

Again - thanks!!