Docker的dumb-init有多重要? [英] How critical is dumb-init for Docker?

查看:1652
本文介绍了Docker的dumb-init有多重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这个问题不会被标记为主要是基于意见的,但是有一个客观的答案。

I hope that this question will not be marked as primarily opinion-based, but that there is an objective answer to it.

我已阅读介绍dumb-init,一个用于Docker容器的init系统,它广泛地描述了为什么以及如何使用 dumb-init 。说实话,对于一个不太熟悉Linux流程结构工作的人来说,这听起来很戏剧化,而且如果你不使用 dumb-init

I have read Introducing dumb-init, an init system for Docker containers, which extensively describes why and how to use dumb-init. To be honest, for someone not too experienced with how the Linux process structure works, this sounds pretty dramatic - and it feels as if you are doing things entirely wrong if you don't use dumb-init.

这就是为什么我正在考虑在我自己的Docker图像中使用它...什么让我这样做是我有尚未找到使用它的官方Docker图像。

This is why I'm thinking about using it within my very own Docker images… what keeps me from doing this is the fact that I have not yet found an official Docker image that uses it.


  • mongo 作为示例:他们直接调用 mongod

  • postgres 为例:他们调用 postgres 直接。

  • 采取节点作为示例:他们调用 node 直接。

  • ...

  • Take mongo as an example: They call mongod directly.
  • Take postgres as an example: They call postgres directly.
  • Take node as an example: They call node directly.

如果 dumb-init 所以很重要 - 为什么显然没有人使用它?我在这里缺少什么?

If dumb-init is so important - why is apparently nobody using it? What am I missing here?

推荐答案

dumb-init tini 可以使用if你有一个过程产生新的过程,你没有实现好的信号处理程序来捕获儿童信号并阻止你的孩子,如果你的进程应该停止等。

Something like dumb-init or tini can be used if you have a process that spawns new processes and you doesn't have good signal handlers implemented to catch child signals and stop your child if your process should be stopped etc.

如果你的进程不会产生新的进程(例如Node.js),这可能不是必需的。

If your process doesn't spawn new processes (e.g., Node.js) then this may not be necessary.

我猜可能运行的MongoDB,PostgreSQL,子进程实现了良好的信号处理程序。否则会有僵尸进程,有人提出了解决这个问题。

I guess that MongoDB, PostgreSQL, ... which may run child processes have good signal handlers implemented. Otherwise there would have been zombie processes and someone had filed an issue to fix this.

只有问题可能是官方语言图像,如节点,红宝石,高卢。他们没有dumb-init / tini,因为你通常不需要它们。但是由开发人员决定,可能会执行坏的子代码来修复信号处理程序或使用帮助器作为PID 1。

Only problem may be the official language images, like node, ruby, golang. They don't have dumb-init/tini in it as you normally don't need them. But it's up to the developer which may implement bad child execution code to either fix the signal handlers or use helper as PID 1.

这篇关于Docker的dumb-init有多重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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