Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the docker-compose equivalent of docker run --init?

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?

like image 304
duggulous Avatar asked May 15 '18 17:05

duggulous


People also ask

Is docker compose up the same as docker run?

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.

What is docker run init?

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.

What is docker compose option?

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.


1 Answers

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

like image 112
whites11 Avatar answered Sep 19 '22 19:09

whites11