I am running a docker container which has a python application that spawns other processes. I am using signals to try to gracefully shut down the python application and all of the spawned processes. When I send SIGTERM using the template from How to process SIGTERM signal gracefully? the entire container terminates. If I remove the logic of managing spawned processes, then the application closes normally and the container remains running (but my other processes are still running). I have tried this with other signals as well, but the result was the same.
Entering loop to listen for sigterm
^CLeaving loop
Killing 188 devices
/bin/sh: line 1: 31 Killed /bin/bash