> For the complete documentation index, see [llms.txt](https://lzcloudsecurity.gitbook.io/yun-an-quan-gong-fang-ru-men/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lzcloudsecurity.gitbook.io/yun-an-quan-gong-fang-ru-men/di-liu-zhang-yun-yuan-sheng-gong-fang/docker-ji-chu-ru-men/docker-shu-ju-guan-li.md).

# Docker数据管理

**数据持久保存**

* &#x20;数据类型分为两种
  * &#x20;数据卷（Data Volume）：直接将宿主机目录挂载至容器指定的目录，此方法较常用；
  * &#x20;数据卷容器（Data Volume Container）：间接使用宿主机空间，先挂载一个专门的数据卷容器。

**数据卷**

* &#x20;使用场景
  * &#x20;数据库
  * 日志输出
  * 应用配置文件
  * &#x20;多容器目录或文件共享

```bash
#方式一
-v 宿主机目录:容器目录
 
#匿名卷
-v 容器路径
docker run -d -v /data/testdir:/data/nginx/htnl/ nginx
```

**数据卷容器**

```bash
--volumes-from
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lzcloudsecurity.gitbook.io/yun-an-quan-gong-fang-ru-men/di-liu-zhang-yun-yuan-sheng-gong-fang/docker-ji-chu-ru-men/docker-shu-ju-guan-li.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
