docker run --init 的 docker-compose 等价物是什么? [英] What's the docker-compose equivalent of docker run --init?
问题描述
根据https://github.com/krallin/tini#using-tini, tini 内置于 docker 中,可以通过将 --init
标志传递给 docker run
来使用.在我的情况下,我使用 docker-compose 并且不直接调用 docker run
.我怎样才能通过这个标志?
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?
推荐答案
如果您使用的是 docker-compose
版本 2,则配置参数称为 init
.
If you are using version 2 of docker-compose
, the configuration parameter is called init
.
示例:
version: '2.2'
services:
web:
image: alpine:latest
init: /usr/libexec/docker-init
请参阅此处了解更多详情:https://docs.docker.com/compose/compose-file/compose-file-v2/#init
Please see here for more details: https://docs.docker.com/compose/compose-file/compose-file-v2/#init
如果您使用的是 docker-compose 版本 3,显然这已被删除并且 在 3.7 版中返回.请参考以下票证:https://github.com/docker/docker.github.io/issues/3149
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
这篇关于docker run --init 的 docker-compose 等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!