According to https://github.com/krallin/tini#using-tini, tini is built into docker, and can be used by passing the --init
flag to docker run
. In my case I'm using docker-compose and don't invoke docker run
directly. How can I pass this flag?
The key difference between docker run versus docker-compose is that docker run is entirely command line based, while docker-compose reads configuration data from a YAML file. The second major difference is that docker run can only start one container at a time, while docker-compose will configure and run multiple.
Specifying an init process ensures the usual responsibilities of an init system, such as reaping zombie processes, are performed inside the created container. The default init process used is the first docker-init executable found in the system path of the Docker daemon process.
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services from your configuration.
If you are using version 2 of docker-compose
, the configuration parameter is called init
.
Example:
version: '2.2' services: web: image: alpine:latest init: /usr/libexec/docker-init
Please see here for more details: https://docs.docker.com/compose/compose-file/compose-file-v2/#init
If you're using docker-compose version 3, apparently this has been removed and returned in version 3.7. Please refer to the following ticket: https://github.com/docker/docker.github.io/issues/3149
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With