How to fix "sh: 0: Can't open start.sh" in docker file? How to fix "sh: 0: Can't open start.sh" in docker file? selenium selenium

How to fix "sh: 0: Can't open start.sh" in docker file?


As a general note, NEVER, NEVER EVER do "chmod 777" on anything.

For whatever purpose you want to achieve, "chmod 0755" should be enough. In extremely rare cases where it might not be, it's still early enough to learn why you need to grant more permissions than that.


If you try and perform each step manually, using docker run with bash,

docker exec -it (container name) /bin/bash

It will be more easier and quicker to look at the errors, and you can change the permissions, view where the file is located, before running the .sh file and try again.


Your mounting your volume to the /selenium folder in your container. Therefor the start.sh file isn't going to be in your working directory its going to be in /selenium. You want to mount your volume to a selenium folder inside your working directory then make sure the command references this new path.

If you use docker-compose the yml file to run the container would look something like this:

version: '3'services:  start:    image: ${DOCKER_IMAGE}    command: sh selenium/start.sh    volumes:      - .:/work/selenium