By default node does not react on SIGTERM, so just a small change to make it happen.
Basically docker will try to gracefully shut down the process, which will cause the application to close the server now, which will at first handle all pending connections and then gracefully shut down
See https://docs.docker.com/engine/reference/commandline/stop/ :
The main process inside the container will receive SIGTERM, and after a grace period, SIGKILL
By default node does not react on SIGTERM, so just a small change to make it happen. Basically docker will try to gracefully shut down the process, which will cause the application to close the server now, which will at first handle all pending connections and then gracefully shut down