Fix words

This commit is contained in:
Baohua Yang
2026-01-10 22:39:51 -08:00
parent e08a34bcdf
commit 8bdb8406f9
36 changed files with 346 additions and 186 deletions

View File

@@ -1,16 +1,39 @@
# podman
[`podman`](https://github.com/containers/podman) 是一个无守护程序docker 命令兼容的下一代 Linux 容器工具。
[`podman`](https://github.com/containers/podman) 是一个无守护进程、Docker 命令高度兼容的下一代 Linux 容器工具。它由 Red Hat 开发,旨在提供一个更安全的容器运行环境。
## Podman vs Docker
| 特性 | Docker | Podman |
| :--- | :--- | :--- |
| **架构** | C/S 架构依赖守护进程 (`dockerd`) | 无守护进程 (Daemonless) |
| **权限** | 默认需要 root 权限 (虽有 Rootless 模式) | 默认支持 Rootless ( root 用户运行) |
| **生态** | 完整的生态系统 (Compose, Swarm) | 专注单机容器配合 Kubernetes 使用 |
| **镜像构建** | `docker build` | `podman build` `buildah` |
## 安装
### CentOS / RHEL
```bash
$ sudo yum -y install podman
```
### macOS
macOS 上需要安装 Podman Desktop 或通过 Homebrew 安装
```bash
$ brew install podman
$ podman machine init
$ podman machine start
```
## 使用
`podman` docker 命令完全兼容只需将 `docker` 替换为 `podman` 即可例如运行一个容器
`podman` 的命令行几乎与 `docker` 完全兼容大多数情况下只需将 `docker` 替换为 `podman` 即可
### 运行容器
```bash
# $ docker run -d -p 80:80 nginx:alpine
@@ -18,6 +41,39 @@ $ sudo yum -y install podman
$ podman run -d -p 80:80 nginx:alpine
```
### 列出容器
```bash
$ podman ps
```
### 构建镜像
```bash
$ podman build -t myimage .
```
## Pods 的概念
Docker 不同Podman 支持 "Pod" 的概念类似于 Kubernetes Pod允许你在同一个网络命名空间中运行多个容器
```bash
# 创建一个 Pod
$ podman pod create --name mypod -p 8080:80
# 在 Pod 中运行容器
$ podman run -d --pod mypod --name webbing nginx
```
## 迁移到 Podman
如果你习惯使用 `docker` 命令可以简单地设置别名
```bash
$ alias docker=podman
```
## 参考
* https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/
* [Podman 官方网站](https://podman.io/)
* [Podman GitHub 仓库](https://github.com/containers/podman)