A Docker Container specification file (Dockerfile
) can be configured to run a containerized application using either ENTRYPOINT
or CMD
.
ENTRYPOINT
is intended to be used when the user wishes for a container to behave as if it were an application.
More information can be found in the Docker Documentation.
An ENTRYPOINT
has two forms, a exec form and a shell form.
Here is an example of the exec form:
ENTRYPOINT ["executable", "param1", "param2", ...]
Here is an example of the shell form:
ENTRYPOINT command param1 param2 ...
The Docker Documentation says the following about the shell form:
The shell form of
ENTRYPOINT
prevents anyCMD
command line arguments from being used. It also starts yourENTRYPOINT
as a subcommand of/bin/sh -c
, which does not pass signals. This means that the executable will not be the container’sPID 1
, and will not receive Unix signals. In this case, your executable doesn’t receive aSIGTERM
fromdocker stop <container>
.
What I don’t understand is what is the intended purpose of this?
- It seems strange to run a container which has signals disabled – the application running inside the container cannot be stopped gracefully
- It also prevents any command line arguments from being used – which seems to contradict the intended purpose of
ENTRYPOINT
to match the behaviour of the container to that of an executable