> For the complete documentation index, see [llms.txt](https://moekiwisama-1.gitbook.io/minecraft-docker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moekiwisama-1.gitbook.io/minecraft-docker/nginx/can-shu-d.md).

# 参数 -d

docker run 以后，进程的标准输出会出现在终端上，这时候我们关闭终端的话，正在运行的 nginx 服务会被终止，我们需要使用 -d 参数让他运行在后台。

我们先通过 Ctrl-C 关闭当前运行的容器

```bash
docker run -p 8080:80 -d nginx
```

![](/files/-McxrA34O-5HKVTwa75b)

我们可以发现它并不像原来那样输出了一堆东西，它输出了一串随机的字符，这一串字符叫做 docker id，它可以标识对应的容器实例，并且这个服务运行在后台了。

这样也可以有助于我们在当前终端运行多个 docker 容器实例，比如说我想再开一个

```bash
docker run -p 8081:80 -d nginx
```

![](/files/-Mcxrytsj0kj_qgAgmvZ)


---

# 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://moekiwisama-1.gitbook.io/minecraft-docker/nginx/can-shu-d.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.
