I test images. Sometimes they use tini
, sometimes they use dumb-init
.
I have noticed a case where the tini
doesn't forward SIGTERM all the way to the app, but dumb-init
does.
I want to understand what's different about how these tools are handling signals.
The problematic case arises when I insert a shim which runs the actual app as a subprocess. The goal is to add a custom signal handler to the shim so that I don't have to modify the app. Ideally this will work without me having to think about whether the image uses tini
or dumb-init
.
In that handler I intend to export telemetry data, but for now it just does echo after
so I can see if it ran.
The problem is that when I do docker stop
, the underlying app doesn't get the signal.
Instead, docker just waits 10 seconds and kills the app--which means that my handler doesn't run.
I think this is because tini runs in single child mode by default, whereas dumb-init runs in process group mode by default. You should be able to reverse these results by running
tini -g
anddumb-init --single-child
.