Shell scripts usually don't forward signals to their children. It needs to be implemented separately.
Signal handling is important for docker(-compose) stop and docker(-compose) rm --stop. If processes in the container do not properly handle SIGTERM, containers cannot be stopped until a certain timeout that triggers a SIGKILL (which should be avoided).
It is also important to check that the main process of a container is not executed in a separate shell by docker, i.e. CMD ["executable","param1","param2"] (or CMD ["param1","param2"] with a proper signal-handling ENTRYPOINT script) should be used instead of CMD command param1 param2 (which executes CMD via sh -c).
Shell scripts usually don't forward signals to their children. It needs to be implemented separately.
Signal handling is important for
docker(-compose) stop
anddocker(-compose) rm --stop
. If processes in the container do not properly handleSIGTERM
, containers cannot be stopped until a certain timeout that triggers aSIGKILL
(which should be avoided).It is also important to check that the main process of a container is not executed in a separate shell by docker, i.e.
CMD ["executable","param1","param2"]
(orCMD ["param1","param2"]
with a proper signal-handlingENTRYPOINT
script) should be used instead ofCMD command param1 param2
(which executesCMD
viash -c
).