This PR wraps the container entrypoint with dumb-init. This allows proper management of external signals and zombie processes.
Without dumb-init, shell signals (such as SIGTERM) are not forwarded to the application, resulting in not being able to gracefully shutdown the application. As proof, if I run the s2i-aspnet-example application in foreground (docker run --name testme --rm -p 8080:8080 s2i-aspnet-example) and then in another console do a docker stop --time=120 testme I can see that the container takes approximately 2 minutes to stop, which means that it is not gracefully stopped. On the docker run console, I can see that the value of $? code is 137, which means that the container was killed with signal 9 (not graceful).
With dumb-init as ENTRYPOINT, the same tests ends up with a graceful shutdown, without having to wait 2 minutes. Container $? code is 0, successful.
Bonus: if the container is run in foreground with -ti argument, dumb-init will handle CTRL-C properly and gracefully shutdown the application (container $? code is 130, which means the process terminated with signal 2, upon receiving CTRL-C).
This PR wraps the container entrypoint with dumb-init. This allows proper management of external signals and zombie processes.
Without dumb-init, shell signals (such as SIGTERM) are not forwarded to the application, resulting in not being able to gracefully shutdown the application. As proof, if I run the s2i-aspnet-example application in foreground (
docker run --name testme --rm -p 8080:8080 s2i-aspnet-example
) and then in another console do adocker stop --time=120 testme
I can see that the container takes approximately 2 minutes to stop, which means that it is not gracefully stopped. On thedocker run
console, I can see that the value of $? code is 137, which means that the container was killed with signal 9 (not graceful).With dumb-init as ENTRYPOINT, the same tests ends up with a graceful shutdown, without having to wait 2 minutes. Container $? code is 0, successful.
Bonus: if the container is run in foreground with
-ti
argument, dumb-init will handle CTRL-C properly and gracefully shutdown the application (container $? code is 130, which means the process terminated with signal 2, upon receiving CTRL-C).