mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-28 20:55:21 +00:00
Remove blank lines after code block markers
This commit is contained in:
@@ -22,7 +22,6 @@ Podman 支持多种操作系统,安装过程也相对简单。
|
||||
```bash
|
||||
$ sudo yum -y install podman
|
||||
```
|
||||
|
||||
#### macOS
|
||||
|
||||
macOS 上需要安装 Podman Desktop 或通过 Homebrew 安装:
|
||||
@@ -32,7 +31,6 @@ $ brew install podman
|
||||
$ podman machine init
|
||||
$ podman machine start
|
||||
```
|
||||
|
||||
### 17.3.3 基本使用
|
||||
|
||||
`podman` 的命令行几乎与 `docker` 完全兼容,大多数情况下,你只需将 `docker` 替换为 `podman` 即可。
|
||||
@@ -40,30 +38,25 @@ $ podman machine start
|
||||
#### 运行容器
|
||||
|
||||
```bash
|
||||
|
||||
## $ docker run -d -p 80:80 nginx:alpine
|
||||
|
||||
$ podman run -d -p 80:80 nginx:alpine
|
||||
```
|
||||
|
||||
#### 列出容器
|
||||
|
||||
```bash
|
||||
$ podman ps
|
||||
```
|
||||
|
||||
#### 构建镜像
|
||||
|
||||
```bash
|
||||
$ podman build -t myimage .
|
||||
```
|
||||
|
||||
### 17.3.4 Pods 的概念
|
||||
|
||||
与 Docker 不同,Podman 支持“Pod”的概念 (类似于 Kubernetes 的 Pod),允许你在同一个网络命名空间中运行多个容器。
|
||||
|
||||
```bash
|
||||
|
||||
## 创建一个 Pod
|
||||
|
||||
$ podman pod create --name mypod -p 8080:80
|
||||
@@ -72,7 +65,6 @@ $ podman pod create --name mypod -p 8080:80
|
||||
|
||||
$ podman run -d --pod mypod --name webbing nginx
|
||||
```
|
||||
|
||||
### 17.3.5 迁移到 Podman
|
||||
|
||||
如果你习惯使用 `docker` 命令,可以简单地设置别名:
|
||||
@@ -80,13 +72,11 @@ $ podman run -d --pod mypod --name webbing nginx
|
||||
```bash
|
||||
$ alias docker=podman
|
||||
```
|
||||
|
||||
#### Systemd 集成
|
||||
|
||||
Podman 可以生成 systemd 单元文件,让容器像普通系统服务一样管理。
|
||||
|
||||
```bash
|
||||
|
||||
## 创建容器
|
||||
|
||||
$ podman run -d --name myweb -p 8080:80 nginx
|
||||
@@ -99,7 +89,6 @@ $ podman generate systemd --name myweb --files --new
|
||||
|
||||
$ systemctl --user enable --now container-myweb.service
|
||||
```
|
||||
|
||||
#### Podman Compose
|
||||
|
||||
虽然 Podman 兼容 Docker Compose,但在某些场景下你可能需要明确使用 `podman-compose`。
|
||||
|
||||
Reference in New Issue
Block a user