docker run immediately returns and does not show output of script.sh

  bash, containers, docker

I have a simple echo.sh file with this: echo "hello" (with or without #!/bin/bash it gives the same error)

this command immediately returns even though there is a echo.sh in this place in the container:

docker run --rm -v $SCRIPTPATH/../:/home/project my_container --entrypoint bash /home/project/echo.sh

and there’s no output, it should say hello.

I did

docker run --rm -v $SCRIPTPATH/../:/home/project -it my_container /bin/bash

 ./echo.sh

and it works.

This is how my Dockerfile ends:

WORKDIR /home/project
ENTRYPOINT "/bin/bash"

What am I doing wrong?

I found many places talking about running a script by doing how I did

Source: Docker Questions

LEAVE A COMMENT