什么是docker-compose等同于docker run --init? [英] What's the docker-compose equivalent of docker run --init?

查看:297
本文介绍了什么是docker-compose等同于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 code>,配置参数称为 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-compose等同于docker run --init?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆