Depending on whether the docker container has been started with -d or -it, the behaviour for ctrl+c is different.
In case docker container is started with -d and then we do an attach to the new docker and press ctrl+c a SIGTERM is sent to the init process and then the init process can trigger the corresponding TERM signals for child processes. This ensures that any process not designed to handle SIGTERM (e.g. consul) can be managed correctly through the init process.
If the docker container is started with -it and we press ctrl+c, SIGTERM is directly sent to all the services started by the /init process. Due to this behaviour there is no control on controlling the handling of SIGTERM within the system.
Depending on whether the docker container has been started with -d or -it, the behaviour for ctrl+c is different. In case docker container is started with -d and then we do an attach to the new docker and press ctrl+c a SIGTERM is sent to the init process and then the init process can trigger the corresponding TERM signals for child processes. This ensures that any process not designed to handle SIGTERM (e.g. consul) can be managed correctly through the init process. If the docker container is started with -it and we press ctrl+c, SIGTERM is directly sent to all the services started by the /init process. Due to this behaviour there is no control on controlling the handling of SIGTERM within the system.