# Docker 运行配置

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com.cn/help/idea/llms.txt).

使用 Docker 运行配置从 IntelliJ IDEA 构建 Docker 镜像并运行容器。 例如，您可以运行一个包含应用程序后端使用的数据库的容器。 或者您可以使用应用程序的二进制文件、依赖项及任何其他必要文件来构建映像。 这称为对应用程序进行“Docker 化”。

> **Note:**
> 如果您希望在特定环境中运行或调试应用程序，请创建一个 [Docker run target](run-targets.html#docker) 并配置 [您的应用程序的运行配置](run-debug-configuration.html)，以使用该运行目标而不是您的机器本地环境。

Procedure: 创建 Docker 运行配置

1. 在主菜单中，前往  `运行 | 编辑配置` 。

2. 在   运行/调试配置   对话框中，点击 ![“添加新配置”按钮](https://resources.jetbrains.com.cn/help/img/idea/2026.3/app.expui.general.add.svg)，展开   Docker   组，并选择所需的运行配置类型。

IntelliJ IDEA 提供以下几种 Docker 运行配置类型：

Docker 镜像
: 当您 [从现有镜像运行容器](docker-containers.html#run_image)时自动创建。 更多信息请参阅 [Docker 映像运行配置](docker-image-run-configuration.html)。
:
:
:
: 具体实例请参阅 [在 Docker 容器中运行数据库](running-a-dbms-image.html)。

Dockerfile
: 当 [从 Dockerfile 运行容器](docker-containers.html#run_image_dockerfile)时自动创建。 更多信息请参阅 [Dockerfile 运行配置](dockerfile-run-configuration.html)。
:
:
:
: 具体实例请参阅 [将 Java 应用程序容器化](dockerize-java-app.html)。

Docker Compose
: 当从 [Docker Compose 文件](https://docs.docker.com/compose/overview/) [运行多容器 Docker 应用程序](docker-compose.html)时自动创建。 如需更多信息，请参阅 [Docker compose 运行配置](docker-compose-run-configuration.html)。

## 在另一个运行配置之前运行 Docker 容器

您可以将任何 Docker 运行配置设置为另一个运行配置的 [启动前](null)任务。 例如，如果您的应用程序依赖于运行中的数据库，每次从源代码运行应用程序时，您可以自动运行包含数据库的 Docker 容器。

## See also

### 参考

[Docker 映像运行配置](docker-image-run-configuration.html) [Dockerfile 运行配置](dockerfile-run-configuration.html) [Docker compose 运行配置](docker-compose-run-configuration.html)

### 相关

[运行/调试配置](run-debug-configuration.html)

### 教程

[在 Docker 容器中运行数据库](running-a-dbms-image.html) [将 Java 应用程序容器化](dockerize-java-app.html)

