About image entrypoints in Minimus and how to work with them
ENTRYPOINT
specifies the container’s default executable. Many Minimus images use a different entrypoint from what is commonly found in their Docker Hub alternatives. Where relevant, the entrypoint was modified to enhance security and/or to enforce an EXEC-form entrypoint, which is more secure than a shell entrypoint.
For example, a Minimus Node image will start up in node rather than in a shell script. This is true for both the dev and non-dev variants of the Minimus Node image. Minimus modified the entrypoint in the production (non-dev) Node.js image because it doesn’t include a shell. To guarantee compatibility and maintain consistency between the two image variants, the development Node image’s entrypoint is aligned and shares the same entrypoint instruction.
/usr/bin/node
entrypoint) rather than starting in a subshell. This has a direct impact on the CMD
instruction.
If you were previously using an image with a sh
entrypoint, your CMD instruction needed to explicitly invoke node:
SIGTERM
signal for graceful shutdown is received by a shell instead of the intended process, the results may be unpredictable. Using a shell-form entrypoint should therefore be avoided on principle.
How to inspect PID1
docker top
ps
utility so instead you can run docker top
from the host to check the processes running inside a container. The first process in the output corresponds to PID 1.docker top
are the host’s PID numbers for the container processes so they will be high. The same processes have different, lower PIDs inside the container (starting with 1 for the init
process).docker inspect --format='{{.State.Pid}}'
docker inspect
to print the PID of the init process (PID 1) for a container:docker inspect {image}
to look up the entrypoint and CMD instruction directly in the CLI.
--entrypoint
flag to the docker run command to replace the default entrypoint specified in the Dockerfile. For example, you can start a dev container in a subshell: