> 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/le-jie-alpine/tong-guo-docker-shi-yong-centos.md).

# 通过 Docker 运行 Centos

Docker 容器运行的应用可以是某个具体的服务，比如 Nginx，也可以是 运行库，比如 Java，也可以是某种 Linux发行。在这时，应用到底是指什么，取决于你想要它实现什么样的功能，并不需要按照这里的图片 <https://app.gitbook.com/@moekiwisama/s/minecraft-docker/docker-yu-chuan-tong-xu-ni-ji-de-qu-bie> 来狭义地理解什么是应用。

例如，我想在 Docker 里运行 Centos

```bash
docker run -it centos
```

![](/files/-McxxFFRPELGNVjoGnwt)

你会惊讶地发现，它运行了 Centos！可是这里操作系统内核并不是容器提供的，是与宿主机共享的，所以他跟直接安装 Centos 虚拟机并不太一样，但是在大部分使用场景下，他们的功能几乎是相同的。

这里我们学习到了两个参数 `-i -t` docker 的参数可以分开写，也可以一起写。

-i 表示打开标准输入，这样你的键盘才可以输入东西到 docker 容器中\
-t 表示为这个实例打开一个终端仿真器，至于什么是终端，可以查看这篇文章。<https://app.gitbook.com/@moekiwisama/s/shell/>

输入 exit 可以退出并关闭当前的容器（应用退出，容器关闭）


---

# 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/le-jie-alpine/tong-guo-docker-shi-yong-centos.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.
