Add tini to Dockerfile and use it as entrypoint #606
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds
tini
as theinit
process for the Teslamate Docker container. The reason for this is that currently the container runs with zombie processes.This means the current process with PID=1 in the container doesn't reap children properly and given the output I get while fixing this, child processes are dying accidentally.
There's also an option to work around this with docker-compose since compose file version 3.7, which allows passing
--init
for the docker container. I'm currently using that to work around the zombie processes, but addingtini
fixes this independent of how people run this container.https://github.com/krallin/tini#why-tini has more explanation as to why it's useful to use it as PID=1 instead of the Erlang VM in this specific case.
Before using a different init, this is what I see locally here:
The zombie processes are visible here. After using
init: true
in my docker-compose locally (I have a new enough version that supports 3.7), it looks like:No zombie processes anymore 😄.
With change, it would show
tini
instead ofdocker-init
, but the end result is the same and that way it's independent of the version of Docker that someone has, whether they pass--init
or have to do something else in case of for example Kubernetes.