Add more content and fix format

This commit is contained in:
Baohua Yang
2026-02-25 21:06:21 -08:00
parent dd449bc84f
commit ecab788013
119 changed files with 566 additions and 496 deletions

View File

@@ -1,16 +1,14 @@
## 8.4 tmpfs 挂载
## 8.3 tmpfs 挂载
`tmpfs` 挂载会把数据放在宿主机内存中而不是写入容器可写层或数据卷
### 8.4.1 适用场景
### 8.3.1 适用场景
- 临时缓存
- 会话数据
- 不希望落盘的敏感中间文件
### 8.4.2 基本用法
如下代码块所示展示了相关示例
### 8.3.2 基本用法
```bash
$ docker run --tmpfs /run:rw,noexec,nosuid,size=64m nginx
@@ -22,13 +20,13 @@ $ docker run --tmpfs /run:rw,noexec,nosuid,size=64m nginx
$ docker run --mount type=tmpfs,destination=/run,tmpfs-size=67108864 nginx
```
### 8.4.3 注意事项
### 8.3.3 注意事项
- 容器停止后`tmpfs` 数据会丢失
- `tmpfs` 占用宿主机内存建议显式限制大小
- 不适合需要持久化的数据
### 8.4.4 Volume / Bind Mount 对比
### 8.3.4 Volume / Bind Mount 对比
| 类型 | 数据位置 | 持久化 | 典型用途 |
|------|---------|-------|---------|