rails7-on-docker icon indicating copy to clipboard operation
rails7-on-docker copied to clipboard

bin/rails: 1: [./entrypoint.sh]: not found

Open VamerVam opened this issue 2 years ago • 8 comments

I tried cloning this project but I am getting the following error.

bin/rails: 1: [./entrypoint.sh]: not found

Please someone help me

VamerVam avatar Sep 06 '22 13:09 VamerVam

@VamerVam I can try to help. Can you share the reproduction steps? What commands did you run? What OS/version and what Docker Version do you have?

ryanwi avatar Sep 07 '22 15:09 ryanwi

@ryanwi I can't speak for @VamerVam but I was able to reproduce this error only after modifying the dockerfile a bit.

Specs

OS: Windows 11 Home Version: 10.0.22000 Build 22000 Docker: 20.10.17, build 100c701

Reproduction Steps

  1. Perform the initial step, it will fail on docker compose run --rm web bin/rails db:setup. It will fail with exec ./entrypoint.sh: no such file or directory.

  2. Not precisely the error reported but then modify ENTRYPOINT ["./entrypoint.sh"] to the other syntax form ENTRYPOINT "./entrypoint.sh" (not sure why one would do this) but that will result in bin/rails: 1: ./entrypoint.sh: not found

My current though is its a CRLF to LF issue on Windows.

mdking avatar Sep 17 '22 05:09 mdking

Hi,

Yes for me the errors were related to CRLF. The files were using CRLF and when updating git to make sure the files are left using LF everything works perfectly.

Perhaps this is what is driving @VamerVam 's experience. Worth configuring git to maintain the LF and not auto-convert them to CRLFs if they are indeed using Windows.

mdking avatar Sep 17 '22 05:09 mdking

Hello! I ran into similar issue except I didn't modify ENTRYPOINT file and then couldn't figure out what is going on. So I ended up with a workaround whereas:

  1. In Dockerfile, I removed the ENTRYPOINT line
  2. For "Initial setup", I ended up with the following commands
cp .env.example .env
docker compose build
docker compose run --rm web bundle install --jobs 4
docker compose run --rm web bin/rails db:setup
  1. The rest of docker compose commands worked

vpibano avatar Mar 23 '23 08:03 vpibano

@vpibano are you running on Windows too?

Without the ENTRYPOINT, the gems may not be installed correctly, so would like to understand this issue better.

ryanwi avatar Mar 24 '23 17:03 ryanwi

@ryanwi I'm also running into the same issue. I'm using Mac OS Sonoma (14.2.1). Error I'm seeing is as follows

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "./bin/docker-entrypoint-dev": permission denied: unknown

vibhoo avatar May 25 '24 19:05 vibhoo

@vibhoo what command are you running?

I did a fresh clone on Mac OS 14.5 and am not seeing that error when starting up.

ryanwi avatar Jun 09 '24 16:06 ryanwi