Docker run override entrypoint with shell script which accepts arguments

It is because of the quotes you’re using around your command.

When you run docker run --entrypoint "/usr/local/tomcat/entrypoint.sh -a param1 -b param2" tomcat:jre8 Docker treats whatever is within those quotes as a single script file.

As you can see from the error:

stat /usr/local/tomcat/entrypoint.sh -a param1 -b param2: 
no such file or directory\"\n".

It’s trying to perform a stat on the file before running it, so it knows if it exists.

Place the arguments to your entrypoint at the end of your docker command like so:

docker run --entrypoint <entrypoint.sh> <image:tag> <arg1> <arg2> <arg3>

Your command becomes:

docker run --entrypoint /usr/local/tomcat/entrypoint.sh tomcat:jre8 -a param1 -b param2 

Have a look at the code snippets in the official documentation:

The ENTRYPOINT of an image is similar to a COMMAND because it
specifies what executable to run when the container starts

https://docs.docker.com/engine/reference/run/#/entrypoint-default-command-to-execute-at-runtime

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)