> 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/shen-me-shi-docker.md).

# 什么是 Docker

## 初步探索什么是 Docker

Docker 是一种类似传统虚拟机的软件，相比传统虚拟机而言，Docker 更加轻量化，也能更加方便地利用已经配置好地环境。

假如我们要在传统的 Linux 虚拟机上运行 Minecraft 服务器，我们需要执行以下几个步骤：

* 安装自己的虚拟机，或从云服务器购买linux服务器
* 安装 java 运行时
* 安装 screen 或 tmux 等使服务运行在后台的工具
* 下载服务端，编写启动脚本
* 启动服务器

但是如果是Docker，我们只需要在已经安装完 Docker 的环境中执行一句指令，即可运行 Minecraft 服务器:

```bash
docker run <Your Image Name>
```

这里的 `Your Image Name` 是你需要自己制作的，当然，本文一开始会让你先尝试使用一些别人制作的 Docker Image。

### 扯了那么多，那么 Docker Image 到底是什么呢

给 Docker Image （Docker 镜像） 直接下定义并不能让人理解它是什么，不过我们可以先描述一下它是如何使用的。

Docker Image 就像是已经装完东西的虚拟机磁盘镜像，它们都拥有一个集成的环境。

比如说，我们这里有一个已经安装完系统的虚拟机镜像，那么我们就可以直接将它导入到虚拟机里，然后启动它。<br>

![](/files/-McxWPEMHgi1DKCGG82a)

如果我们需要启动多个 Minecraft 服务器，最简单的方法就是把这个虚拟机镜像导出进多个虚拟机。（假如我要开 10 个服务器，那我就开 10 个虚拟机），当然，这是很蠢的方法，并且这将导致比较大的性能浪费（例如 10 个虚拟机就需要运行 10 个 Linux 操作系统）

实际上，对于虚拟机来说，我们偏向于在一个虚拟机内运行多个 Minecraft 服务，但是如果是换做 Docker ，我们其实真的会将同一个 Image 运行 10份，这样就可以获得 10 个服务器。

```bash
docker run <My Docker Image> # 跑十次
```

![](/files/-McxXON5bykD5v6h548C)

虚拟机通过导入制作完的镜像，获得的东西会被称作虚拟机实例（Vm Instance），那么很自然地，通过 Docker Image 运行的东西，会被叫做 Docker 实例 （Docker Instance）。

欸？那么 Docker 跟传统的虚拟机非常相似咯？\
是的。


---

# 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/shen-me-shi-docker.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.
