> 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)
