Files
docker_practice/08_data/summary.md
2026-03-09 20:04:21 -07:00

30 lines
1.4 KiB
Go
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.

## 本章小结
本章介绍了 Docker 的三种数据管理方式数据卷 (Volume)绑定挂载 (Bind Mount) tmpfs 挂载
| 方式 | 特点 | 适用场景 |
|------|------|---------|
| **数据卷 (Volume)** | Docker 管理生命周期独立于容器 | 数据库应用数据推荐生产环境 |
| **绑定挂载 (Bind Mount)** | 挂载宿主机目录更灵活 | 开发环境配置文件日志 |
| **tmpfs 挂载** | 仅存储在内存中容器停止即消失 | 临时敏感数据高速缓存 |
| 操作 | 命令 |
|------|------|
| 创建数据卷 | `docker volume create name` |
| 列出数据卷 | `docker volume ls` |
| 查看详情 | `docker volume inspect name` |
| 删除数据卷 | `docker volume rm name` |
| 清理未用 | `docker volume prune` |
| 挂载数据卷 | `-v name:/path` `--mount source=name,target=/path` |
### 延伸阅读
- [数据卷](8.1_volume.md)Docker 管理的持久化存储
- [绑定挂载](8.2_bind-mounts.md)挂载宿主机目录
- [tmpfs 挂载](8.3_tmpfs.md)内存中的临时存储
- [存储驱动](../12_implementation/12.4_ufs.md)Docker 存储的底层原理
- [Compose 数据管理](../11_compose/11.5_compose_file.md)Compose 中的挂载配置
---
> 📝 **发现错误或有改进建议** 欢迎提交 [Issue](https://github.com/yeasy/docker_practice/issues) 或 [PR](https://github.com/yeasy/docker_practice/pulls)。