# Podman

**Podman** 是一款无守护进程的开源 Linux 原生工具，用于借助开放容器倡议（OCI）容器与容器镜像来查找、运行、构建、共享和部署应用。它提供的命令行界面对 Docker 用户来说十分熟悉，熟悉到大多数用户可以直接把 Docker 设为 Podman 的别名（`alias docker=podman`）；它既能以 root 身份运行容器，也能以其标志性的无根模式，作为非特权用户运行容器。<sup>[1](https://docs.podman.io/en/v3.0/)</sup>

| 关键事实 | 详情 |
|---|---|
| 架构 | 无守护进程；容器以 fork/exec 模型作为子进程启动，而非由中央守护进程管理<sup>[1](https://docs.podman.io/en/v3.0/)</sup><sup> • </sup><sup>[2](https://people.redhat.com/mskinner/rhug/q1.2024/Podman-PodmanDesktop.pdf)</sup> |
| 运行时 | 依赖符合 OCI 规范的容器运行时（runc、crun、runv 等）与操作系统对接<sup>[1](https://docs.podman.io/en/v3.0/)</sup> |
| 无根模式 | 使用 `/etc/subuid` 和 `/etc/subgid` 中定义的用户命名空间，以非特权用户身份运行容器<sup>[3](https://docs.podman.io/en/v3.4.4/markdown/podman.1.html)</sup> |
| 首个稳定版本 | Podman v1.0.0，2019 年 1 月 16 日发布，此前在 2018 年发布过 alpha 版本<sup>[4](https://podman.io/release/archive)</sup> |
| systemd 集成 | 自 Podman v4.6 起提供 Quadlet，以类似常规 systemd 单元文件的格式描述容器<sup>[5](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/building_running_and_managing_containers/red_hat_enterprise_linux-8-building_running_and_managing_containers-en-us.pdf)</sup> |
| Compose | `podman compose` 是外部 compose 提供程序（如 docker-compose 或 podman-compose）的薄封装<sup>[6](https://docs.podman.io/en/v5.6.2/markdown/podman-compose.1.html)</sup> |
| 当前发布线 | v6.x；所列最新版本为 v6.1.3<sup>[7](https://github.com/podman-container-tools/podman/releases)</sup> |

## 架构

Podman 与 Docker 的区别在于容器的启动方式和归属方式。Docker 运行一个长期存活的守护进程来管理容器；Podman 则以 fork/exec 模型将容器作为子进程启动，因此不存在需要以 root 身份运行或可能成为单点故障的中央守护进程。<sup>[2](https://people.redhat.com/mskinner/rhug/q1.2024/Podman-PodmanDesktop.pdf)</sup> 与其他常见容器引擎（Docker、CRI-O、containerd）一样，Podman 依赖符合 OCI 规范的容器运行时（如 runc、crun 或 runv）与操作系统对接并创建运行中的容器，这使得 Podman 创建的容器与其他引擎创建的容器几乎无从区分。<sup>[1](https://docs.podman.io/en/v3.0/)</sup>

其命令行界面在设计上兼容 Docker 的 CLI，两个工具从同一批镜像构建并运行 OCI 容器，暴露的命令几乎完全相同。<sup>[1](https://docs.podman.io/en/v3.0/)</sup><sup> • </sup><sup>[8](https://linuxize.com/post/podman-vs-docker/)</sup> Podman 还为需要以编程方式交互的开发者提供了 API。<sup>[1](https://docs.podman.io/en/v3.0/)</sup>

## 无根模式

Podman 可以完全以非 root 用户身份使用。在无根运行中，Podman 会自行为此账户建立用户命名空间，命名空间的 ID 映射取自 `/etc/subuid` 和 `/etc/subgid`，这两个文件必须为该账户分配若干 UID 和 GID；一种常见配置是通过 `usermod --add-subuids` 授予类似 10000-75535 的区间。<sup>[3](https://docs.podman.io/en/v3.4.4/markdown/podman.1.html)</sup> 非 root 用户创建的容器对其他用户不可见，而以 root 启动的 Podman 既看不到也无法管理这些容器。<sup>[3](https://docs.podman.io/en/v3.4.4/markdown/podman.1.html)</sup>

无根运行对存储和网络有所限制。在 5.12.9 之前的内核上，无根模式不支持 OverlayFS；在此类系统上，如果已安装 fuse-overlayfs 程序，且尚未创建 `$HOME/.config/containers/storage.conf`，Podman 会自动使用它作为挂载程序。<sup>[9](https://docs.podman.io/en/latest/markdown/podman.1.html)</sup> 包括 NFS、Lustre、Spectrum Scale 和 [GPFS](https://www.edgepedia.org/zh/gpfs) 在内的网络文件系统在无根模式下不受支持，因为它们无法理解用户命名空间；不过无根用户可以将 storage.conf 中的 `graphroot` 选项指向本地存储，以便在主目录位于 NFS 的情况下继续工作。<sup>[9](https://docs.podman.io/en/latest/markdown/podman.1.html)</sup> 在高性能计算等用户无法获得 subuid 和 subgid 区间的环境中，无根 Podman 可以通过设置 `ignore_chown_errors` 选项，以单一 UID 运行，将所有镜像文件都保存在用户自己的 UID 下，代价是可能引发运行时问题。<sup>[9](https://docs.podman.io/en/latest/markdown/podman.1.html)</sup>

在无根网络方面，当前版本的 Podman 要求安装 pasta 才能创建网络设备；否则无根容器必须在宿主机的网络命名空间中运行。<sup>[9](https://docs.podman.io/en/latest/markdown/podman.1.html)</sup> 早期版本出于同样目的需要 slirp4netns 包，如今 slirp4netns 被视为仅用于兼容的遗留后端。<sup>[3](https://docs.podman.io/en/v3.4.4/markdown/podman.1.html)</sup><sup> • </sup><sup>[10](https://sanj.dev/post/docker-vs-podman-comparison/)</sup>

## systemd 集成与 Quadlet

自 Podman v4.6 起，Quadlet 工具以类似常规 systemd 单元文件的格式描述如何运行容器，相比旧的 `podman generate systemd` 命令有若干优势：描述聚焦于容器细节并隐藏 systemd 机制；Podman 升级并执行 `systemctl daemon-reload` 时服务会自动更新；简化的语法允许从零编写文件；并且通过 `[Container]` 段等新表支持标准 systemd 选项。<sup>[5](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/building_running_and_managing_containers/red_hat_enterprise_linux-8-building_running_and_managing_containers-en-us.pdf)</sup>

Quadlet 支持多种单元文件类型：`.container` 用于运行容器，`.kube` 用于通过 `podman kube play` 运行 [Kubernetes](https://www.edgepedia.org/zh/kubernetes) YAML 中定义的容器，`.network` 用于 Podman 网络，`.volume` 用于 Podman 卷。<sup>[5](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/building_running_and_managing_containers/red_hat_enterprise_linux-8-building_running_and_managing_containers-en-us.pdf)</sup> 它还支持 Kubernetes YAML 能力的一个子集，YAML 文件可以用 `podman generate kube`、OpenShift 的 `oc generate --dry-run` 或 `kubectl create --dry-run` 生成。<sup>[5](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/building_running_and_managing_containers/red_hat_enterprise_linux-8-building_running_and_managing_containers-en-us.pdf)</sup> Quadlet 需要 cgroup v2，可用 `podman info --format {{.Host.CgroupsVersion}}` 检查。<sup>[11](https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html)</sup> 由于 Quadlet 单元在启动时可能需要拉取或构建镜像，这可能超出 systemd 默认 90 秒的服务启动时限，因此可以预先拉取镜像，或用 `TimeoutStartSec` 调高时限。<sup>[11](https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html)</sup> 从 Podman v5.0 开始，Quadlet 还可以根据 Pod 描述生成 systemd 服务。<sup>[12](https://www.youtube.com/watch?v=LsZB_mI7TcQ)</sup>

## Pod 与 Kubernetes YAML

Podman 管理 Pod，即共享命名空间的容器组，并可通过 `podman kube play` 根据结构化的 Kubernetes YAML 输入文件创建并运行容器、Pod，或创建卷。<sup>[9](https://docs.podman.io/en/latest/markdown/podman.1.html)</sup> 这为多容器应用提供了两条路径：可随后迁移到 Kubernetes 集群的 Kubernetes YAML，或让容器表现得像 systemd 服务、在重启后恢复运行的 Quadlet 文件。<sup>[12](https://www.youtube.com/watch?v=LsZB_mI7TcQ)</sup>

## Compose 兼容性

Podman 本身不实现 Compose。`podman compose` 子命令是外部 compose 提供程序（如 docker-compose 或 podman-compose）的薄封装；它会配置好环境，使提供程序与本地 Podman 套接字透明通信，且默认情况下若已安装 docker-compose 则优先使用它。<sup>[6](https://docs.podman.io/en/v5.6.2/markdown/podman-compose.1.html)</sup> 社区项目 podman-compose 力求兼容 docker-compose，但记录了行为差异，包括名称分隔符（下划线对连字符）、默认网络命名和默认网络行为，这些均可通过 `x-podman` 键下的兼容性设置调整。<sup>[13](https://github.com/containers/podman-compose/blob/main/docs/Extensions.md)</sup>

## 历史与版本

首批 alpha 版本于 2018 年出现，始于 2018 年 6 月的 0.6.1 版；Podman v1.0.0 于 2019 年 1 月 16 日发布。<sup>[4](https://podman.io/release/archive)</sup> 此后主要版本线稳步跟进：2020 年 10 月的 v2.1.0、2021 年 2 月的 v3.0.0 和 2022 年 2 月的 v4.0.0。<sup>[4](https://podman.io/release/archive)</sup> 项目在 GitHub 的 containers 组织下开发，现为 podman-container-tools/podman，发布版本由马特·希恩等维护者签名。<sup>[7](https://github.com/podman-container-tools/podman/releases)</sup>

近期版本包含安全修复。v6.1.3 版修复了 CVE-2026-94603，该漏洞中针对检查点镜像执行 `podman run` 可能禁用所有沙箱；同时作为破坏性变更，移除了 `podman run` 对检查点镜像的支持。<sup>[7](https://github.com/podman-container-tools/podman/releases)</sup>

## 生态系统与性能

该项目的图形化伴侣 Podman Desktop 已被接纳为[云原生计算基金会](https://www.edgepedia.org/zh/cloud-native-computing-foundation)（CNCF）沙箱项目。<sup>[14](https://www.redhat.com/rhdc/managed-files/What_s_Next_in_OpenShift_Q2CY2025.pdf)</sup> podman 包可在 Ubuntu 20.10 及更新版本的官方仓库中获取，Podman 还可以通过 FreeBSD 的 Linux 模拟层运行许多 Linux 容器镜像。<sup>[15](https://podman.io/docs/installation)</sup>

与 Docker 相比，实测性能差异很小。在一组测试中，使用已预热（warm）的 alpine 镜像并运行 hyperfine 基准测试 20 多次，Docker 的平均值为 352 毫秒，而无根 Podman 为 342 毫秒——差距小到落在测量噪声范围内。<sup>[16](https://botmonster.com/self-hosting/podman-vs-docker-linux-container-runtime/)</sup>

## References

1. [What is Podman? — Podman documentation](https://docs.podman.io/en/v3.0/)
2. [Simplifying containers & Kubernetes, Red Hat Developer presentation (Podman Desktop)](https://people.redhat.com/mskinner/rhug/q1.2024/Podman-PodmanDesktop.pdf)
3. [podman(1) — Podman documentation, v3.4.4 (Rootless mode)](https://docs.podman.io/en/v3.4.4/markdown/podman.1.html)
4. [Release archive, podman.io](https://podman.io/release/archive)
5. [Red Hat Enterprise Linux 8: Building, running, and managing containers (Chapter 14)](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/building_running_and_managing_containers/red_hat_enterprise_linux-8-building_running_and_managing_containers-en-us.pdf)
6. [podman-compose — Podman documentation, v5.6.2](https://docs.podman.io/en/v5.6.2/markdown/podman-compose.1.html)
7. [Releases · podman-container-tools/podman, GitHub](https://github.com/podman-container-tools/podman/releases)
8. [Podman vs Docker: Differences and Migration Guide, Linuxize](https://linuxize.com/post/podman-vs-docker/)
9. [podman(1) — Podman documentation, latest (rootless storage and networking notes)](https://docs.podman.io/en/latest/markdown/podman.1.html)
10. [Docker vs Podman 2026: Rootless Networking, Benchmarks & Migration Guide, sanj.dev](https://sanj.dev/post/docker-vs-podman-comparison/)
11. [podman-systemd.unit(5) — Podman documentation](https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html)
12. [Quadlets, Pods, and working with the latest Podman, Podman 5 — Red Hat Enterprise Linux (YouTube)](https://www.youtube.com/watch?v=LsZB_mI7TcQ)
13. [podman-compose Extensions documentation, GitHub](https://github.com/containers/podman-compose/blob/main/docs/Extensions.md)
14. [What's Next in OpenShift Q2 CY2025, Red Hat](https://www.redhat.com/rhdc/managed-files/What_s_Next_in_OpenShift_Q2CY2025.pdf)
15. [Podman Installation, podman.io](https://podman.io/docs/installation)
16. [Podman vs Docker for self-hosting: I measured the difference, Botmonster Tech](https://botmonster.com/self-hosting/podman-vs-docker-linux-container-runtime/)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Named software products and platforms › Cloud, virtualization, and containers › Container tools and runtimes

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/podman

English original: https://www.edgepedia.org/podman
