Files
nexus/wiki/entities/tini.md

32 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "tini"
type: entity
tags: [Container, Kubernetes, Security, Open Source, Init System]
last_updated: 2026-04-24
---
## Basic Information
- **Type:** Product / Open Source Tool
- **Category:** Container Init System
- **Website:** https://github.com/krallin/tini
- **Language:** C
## Description
tini 是 Docker 和 Kubernetes 容器中最广泛使用的轻量级 Init 系统,用于:
1. **信号处理**:正确接收并转发 SIGTERM/SIGINT 等信号到子进程,确保容器可优雅停止
2. **僵尸进程收割**:防止已终止但父进程尚未 wait() 的子进程Zombie Process占用系统资源
3. **单进程容器**:在无 systemd 的容器环境中替代 PID 1 职责
在 [[ctp-topic-49-container-lifecycle-hardening-standards]] 中Ashish 通过 Demo 展示了 tini 如何在 Kubernetes 环境中阻止僵尸进程——当容器不运行 Init 系统时,僵尸进程会耗尽系统资源;引入 tini 后僵尸进程被正确收割。
## Relationship to Kubernetes
- Kubernetes Pod 默认使用容器镜像的 PID 1 作为 Init 进程
- 在 Kubernetes 中可通过 Pod Security Context 或 Init Container 方式集成 tini
## Aliases
- tini
- teenyCTP Topic 49 Demo 中提到的替代名称,指同一机制)
## Sources
- [[ctp-topic-49-container-lifecycle-hardening-standards]]