Skip to content

Commit 85798c6

Browse files
committed
docs: update docker compose environment docs
1 parent 6d24394 commit 85798c6

5 files changed

Lines changed: 74 additions & 28 deletions

File tree

en/self-host/advanced-deployments/local-source-code.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ A series of middlewares for storage (e.g. PostgreSQL / Redis / Weaviate (if not
3131
```bash
3232
cd docker
3333

34-
cp middleware.env.example middleware.env
34+
cp envs/middleware.env.example middleware.env
3535

36-
# change the profile to mysql if you are not using postgresql
37-
# change the profile to other vector database if you are not using weaviate
38-
docker compose -f docker-compose.middleware.yaml --profile postgresql --profile weaviate -p dify up -d
36+
# Change DB_TYPE or COMPOSE_PROFILES in middleware.env if you are not using PostgreSQL and Weaviate.
37+
docker compose --env-file middleware.env -f docker-compose.middleware.yaml -p dify up -d
3938
```
4039

4140
---

en/self-host/configuration/environments.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,21 @@ description: Reference for all environment variables used by Dify self-hosted de
66
Dify works out of the box with default settings. You can customize your deployment by modifying the environment variables in the `.env` file.
77

88
<Tip>
9-
After upgrading Dify, run `diff .env .env.example` in the `docker` directory to check for newly added or changed variables, then update your `.env` file accordingly.
9+
After upgrading Dify, compare `.env` with `.env.example` in the `docker` directory. If you copied optional files under `envs/`, compare each copied `.env` file with its matching `.env.example` file.
1010
</Tip>
1111

12+
## Configuration Files
13+
14+
Docker Compose reads essential startup values from `docker/.env`, which you create from `docker/.env.example`. Optional and provider-specific variables live in `docker/envs/**/*.env.example`.
15+
16+
To customize optional settings, copy the matching file without the `.example` suffix, then edit the copied file. For example:
17+
18+
```bash
19+
cp envs/vectorstores/milvus.env.example envs/vectorstores/milvus.env
20+
```
21+
22+
Values in `docker/.env` take precedence over values in files under `docker/envs/`. This page lists variables from both `docker/.env.example` and the optional examples under `docker/envs/`.
23+
1224
## Common Variables
1325

1426
These URL variables configure the addresses of Dify's various services.
@@ -1294,6 +1306,8 @@ These configure the Squid-based SSRF proxy container that blocks requests to int
12941306

12951307
## Docker Compose
12961308

1309+
These variables stay in `docker/.env` because Docker Compose uses them to select profiles and expose ports before containers start.
1310+
12971311
| Variable | Default | Description |
12981312
|---|---|---|
12991313
| `COMPOSE_PROFILES` | `${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}` | Automatically selects which service containers to start based on your database and vector store choices. For example, setting `DB_TYPE=mysql` starts MySQL instead of PostgreSQL. |
@@ -1614,4 +1628,4 @@ The plugin daemon can store plugin packages in different storage backends. Confi
16141628
| `PLUGIN_VOLCENGINE_TOS_REGION` | (empty) | Volcengine TOS region. |
16151629

16161630
</Accordion>
1617-
</AccordionGroup>
1631+
</AccordionGroup>

en/self-host/quick-start/docker-compose.mdx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ Make sure your machine meets the following minimum system requirements.
1818

1919
### Software
2020

21-
| Operating System | Required Software | Notes |
22-
| :----------------------------- | :---------------------------------------- | :----- |
23-
| macOS 10.14 or later | Docker Desktop | Configure the Docker virtual machine with at least 2 virtual CPUs and 8 GiB of memory. <br></br><br></br>For installation instructions, see [Install Docker Desktop on Mac](https://docs.docker.com/desktop/mac/install/). |
24-
| Linux distributions | Docker 19.03+<br></br><br></br>Docker Compose 1.28+ | For installation instructions, see [Install Docker Engine](https://docs.docker.com/engine/install/) and [Install Docker Compose](https://docs.docker.com/compose/install/). |
25-
| Windows with WSL 2 enabled | Docker Desktop | Store source code and data bound to Linux containers in the Linux file system rather than Windows. <br></br><br></br>For installation instructions, see [Install Docker Desktop on Windows](https://docs.docker.com/desktop/windows/install/#wsl-2-backend). |
21+
| Operating System | Required Software | Notes |
22+
| :----------------------------- | :---------------------------------------- | :----- |
23+
| macOS 10.14 or later | Docker Desktop with Docker Compose 2.24.0+ | Configure the Docker virtual machine with at least 2 virtual CPUs and 8 GiB of memory. <br></br><br></br>For installation instructions, see [Install Docker Desktop on Mac](https://docs.docker.com/desktop/mac/install/). |
24+
| Linux distributions | Docker 19.03+<br></br><br></br>Docker Compose 2.24.0+ | For installation instructions, see [Install Docker Engine](https://docs.docker.com/engine/install/) and [Install Docker Compose](https://docs.docker.com/compose/install/). |
25+
| Windows with WSL 2 enabled | Docker Desktop with Docker Compose 2.24.0+ | Store source code and data bound to Linux containers in the Linux file system rather than Windows. <br></br><br></br>For installation instructions, see [Install Docker Desktop on Windows](https://docs.docker.com/desktop/windows/install/#wsl-2-backend). |
2626

2727

2828
## Deploy and Start
@@ -46,22 +46,19 @@ Make sure your machine meets the following minimum system requirements.
4646
2. Copy the example environment configuration file:
4747

4848
```bash
49-
cp .env.example .env
49+
cp .env.example .env
5050
```
5151

52-
3. Start the containers using the command that matches your Docker Compose version:
52+
The root `.env` file contains the essential startup values. Optional and provider-specific settings live under `envs/` as `.env.example` files. Copy only the files you need without the `.example` suffix before editing those advanced settings.
5353

54-
<CodeGroup>
55-
```bash Docker Compose V2
56-
docker compose up -d
57-
```
58-
```bash Docker Compose V1
59-
docker-compose up -d
60-
```
61-
</CodeGroup>
54+
3. Start the containers:
55+
56+
```bash
57+
docker compose up -d
58+
```
6259

6360
<Tip>
64-
Run `docker compose version` to check your Docker Compose version.
61+
Dify uses optional Compose `env_file` entries. Run `docker compose version` and make sure your Docker Compose version is 2.24.0 or later.
6562
</Tip>
6663

6764
The following containers will be started:
@@ -137,13 +134,21 @@ Make sure your machine meets the following minimum system requirements.
137134

138135
## Customize
139136

140-
Modify the environment variable values in your local `.env` file, then restart Dify to apply the changes:
137+
Modify environment variables in your local `.env` file, then restart Dify to apply the changes:
141138

142139
```bash
143140
docker compose down
144141
docker compose up -d
145142
```
146143

144+
For optional or provider-specific settings, copy the matching file from `envs/` without the `.example` suffix, then edit the copied file. For example:
145+
146+
```bash
147+
cp envs/vectorstores/milvus.env.example envs/vectorstores/milvus.env
148+
```
149+
150+
Values in `.env` take precedence over values in files under `envs/`.
151+
147152
<Tip>
148153
For more information, see [environment variables](/en/self-host/configuration/environments).
149154
</Tip>
@@ -154,6 +159,6 @@ Upgrade steps may vary between releases. Refer to the upgrade guide for your tar
154159

155160
<Note>
156161

157-
After upgrading, check whether the `.env.example` file has changed and update your local `.env` file accordingly.
162+
After upgrading, check whether `.env.example` or any copied `envs/**/*.env.example` files have changed, then update your local `.env` and optional `envs/**/*.env` files accordingly.
158163

159-
</Note>
164+
</Note>

ja/self-host/configuration/environments.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,21 @@ description: Dify セルフホストデプロイで使用されるすべての
88
Dify はデフォルト設定でそのまま動作します。`.env` ファイルの環境変数を変更することで、デプロイをカスタマイズできます。
99

1010
<Tip>
11-
Dify をアップグレードした後、`docker`ディレクトリで `diff .env .env.example`を実行して、新しく追加または変更された変数を確認し、`.env` ファイルを適宜更新してください
11+
Dify をアップグレードした後、`docker` ディレクトリで `.env``.env.example` を比較してください。`envs/` 配下の任意ファイルをコピーしている場合は、コピー済みの各 `.env` ファイルを対応する `.env.example` ファイルと比較してください
1212
</Tip>
1313

14+
## 設定ファイル
15+
16+
Docker Compose は、`docker/.env.example` から作成した `docker/.env` から基本的な起動値を読み込みます。任意設定やプロバイダー固有の変数は `docker/envs/**/*.env.example` にあります。
17+
18+
任意設定をカスタマイズするには、該当ファイルを `.example` サフィックスなしでコピーしてから、コピーしたファイルを編集します。例:
19+
20+
```bash
21+
cp envs/vectorstores/milvus.env.example envs/vectorstores/milvus.env
22+
```
23+
24+
`docker/.env` の値は、`docker/envs/` 配下のファイルの値より優先されます。このページでは、`docker/.env.example``docker/envs/` 配下の任意サンプルファイルの両方にある変数を一覧しています。
25+
1426
## 共通変数
1527

1628
これらの URL 変数は、Dify の各サービスのアドレスを設定します。
@@ -1296,6 +1308,8 @@ HTTPS を有効化した後、 [共通変数](#共通変数) の URL 変数(
12961308

12971309
## Docker Compose
12981310

1311+
これらの変数は、コンテナ起動前に Docker Compose が Compose profiles の選択とポート公開に使用するため、`docker/.env` に残ります。
1312+
12991313
| 変数 | デフォルト値 | 説明 |
13001314
|---|---|---|
13011315
| `COMPOSE_PROFILES` | `${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}` | データベースとベクトルストアの選択に基づいて、起動するサービスコンテナを自動選択します。例えば、`DB_TYPE=mysql` を設定すると PostgreSQL の代わりに MySQL が起動します。 |
@@ -1616,4 +1630,4 @@ API と Celery ワーカー間の Redis ベースのイベント転送です。
16161630
| `PLUGIN_VOLCENGINE_TOS_REGION` | (空) | Volcengine TOS リージョン。 |
16171631

16181632
</Accordion>
1619-
</AccordionGroup>
1633+
</AccordionGroup>

zh/self-host/configuration/environments.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,21 @@ description: Dify 自托管部署使用的所有环境变量参考
88
Dify 使用默认配置即可开箱即用。你可以通过修改 `.env` 文件中的环境变量来自定义部署。
99

1010
<Tip>
11-
升级 Dify 后,在 `docker` 目录下运行 `diff .env .env.example` 检查新增或变更的变量,然后相应更新你的 `.env` 文件
11+
升级 Dify 后,在 `docker` 目录中比较 `.env``.env.example`。如果你复制了 `envs/` 下的可选文件,请将每个复制出的 `.env` 文件与对应的 `.env.example` 文件进行比较
1212
</Tip>
1313

14+
## 配置文件
15+
16+
Docker Compose 从 `docker/.env` 读取基础启动值,该文件由 `docker/.env.example` 复制而来。可选变量和特定供应商变量位于 `docker/envs/**/*.env.example`
17+
18+
如需自定义可选设置,请复制对应文件并去掉 `.example` 后缀,然后编辑复制出的文件。例如:
19+
20+
```bash
21+
cp envs/vectorstores/milvus.env.example envs/vectorstores/milvus.env
22+
```
23+
24+
`docker/.env` 中的值优先于 `docker/envs/` 下文件中的值。本页同时列出 `docker/.env.example``docker/envs/` 下可选示例文件中的变量。
25+
1426
## 通用变量
1527

1628
这些 URL 变量用于配置 Dify 各服务的访问地址。
@@ -1296,6 +1308,8 @@ Dify 的所有出站 HTTP 请求(HTTP 节点、图片下载等)都通过代
12961308

12971309
## Docker Compose
12981310

1311+
这些变量保留在 `docker/.env` 中,因为 Docker Compose 会在容器启动前使用它们选择 Compose profiles 并暴露端口。
1312+
12991313
| 变量 | 默认值 | 说明 |
13001314
|---|---|---|
13011315
| `COMPOSE_PROFILES` | `${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}` | 根据你的数据库和向量存储选择自动决定启动哪些服务容器。例如设置 `DB_TYPE=mysql` 将启动 MySQL 而非 PostgreSQL。 |

0 commit comments

Comments
 (0)