Allowing Unix signaling

One may argue that an extra process is not important in the grand scheme of things, but there are further implications of running commands inside a shell.

When using the shell form for the CMD or ENTRYPOINT instruction, the executable is run inside an additional shell process, which means it will not be run with PID of 1, which means it will not receive Unix signals.

Unix signals are passed by the Docker daemon to control containers. For instance, when running docker stop hobnob, the daemon will send a SIGTERM signal to the hobnob container’s root process (PID 1).

When using the shell form, it is the shell which receives this signal. If we are using sh as the shell, it will not pass the signal on to the processes it ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.