Table of Contents

About

ENTRYPOINT 1) is a docker instruction that defines the default docker entrypoint

Assignment format

It has two different behavior that depends on the assignment format. ENTRYPOINT has the following forms:

# exec form, preferred
ENTRYPOINT ["executable", "param1", "param2"] 
# or shell form
ENTRYPOINT command param1 param2 
# or
ENTRYPOINT ["python"]
CMD ["myPythonFile.py"]

If you want to get the parameters from the command line passed to the entry point, you need to choose the exec form

Exec form

Command line arguments to docker run will be appended after all elements in an exec form ENTRYPOINT, and will override all elements specified using CMD.

Shell form

The shell form prevents any command line arguments (cmd or via run) from being used.

The ENTRYPOINT will be started as a subcommand of /bin/sh -c, which does not pass signals. This means that the executable will not be the container’s PID 1 - and will not receive Unix signals - so your executable will not receive a SIGTERM from docker stop containerName.

Multiple processes

If you start many processes, check this page: How to start multiple processes in Docker?