Skip to content

Commit 3dee5c7

Browse files
committed
docs: update docker compose environment docs
1 parent 6d24394 commit 3dee5c7

10 files changed

Lines changed: 99 additions & 50 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Local Source Code Start
3+
description: Run Dify locally from source with middleware services started by Docker Compose
34
---
45

56
## Prerequisites
@@ -31,11 +32,10 @@ A series of middlewares for storage (e.g. PostgreSQL / Redis / Weaviate (if not
3132
```bash
3233
cd docker
3334

34-
cp middleware.env.example middleware.env
35+
cp envs/middleware.env.example middleware.env
3536

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
37+
# Change DB_TYPE or COMPOSE_PROFILES in middleware.env if you are not using PostgreSQL and Weaviate.
38+
docker compose --env-file middleware.env -f docker-compose.middleware.yaml -p dify up -d
3939
```
4040

4141
---

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/platform-guides/dify-premium.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Dify Premium on AWS
3+
description: Deploy, customize, and upgrade Dify Premium on AWS Marketplace
34
---
45

56
Dify Premium is our AWS AMI offering that allows custom branding and is one-click deployable to your AWS VPC as an EC2 instance. Head to [AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-t22mebxzwjhu6) to subscribe. It's useful in a couple of scenarios:
@@ -21,8 +22,8 @@ If this is your first time accessing Dify, enter the Admin initialization passwo
2122
Just like a self-hosted deployment, you may modify the environment variables in the `.env` file in your EC2 instance as you see fit. Then, restart Dify with:
2223

2324
```bash
24-
docker-compose down
25-
docker-compose -f docker-compose.yaml -f docker-compose.override.yaml up -d
25+
docker compose down
26+
docker compose -f docker-compose.yaml -f docker-compose.override.yaml up -d
2627
```
2728

2829
### Web App Logo & Branding
@@ -41,7 +42,7 @@ In the EC2 instance, run the following commands:
4142
<Step title="Stop the Running Services">
4243
```bash
4344
cd /dify
44-
docker-compose down
45+
docker compose down
4546
```
4647
</Step>
4748
<Step title="Back Up Your Data">
@@ -68,16 +69,16 @@ In the EC2 instance, run the following commands:
6869
```
6970
</Step>
7071
<Step title="Check for New Environment Variables">
71-
New versions may introduce new environment variables in `.env.example`. Compare it with your current `.env` and add any missing variables:
72+
New versions may introduce variables in `.env.example` or optional examples under `envs/`. Compare `.env` with `.env.example`, and repeat the comparison for any copied `envs/**/*.env` file against its matching `.env.example` file:
7273

7374
```bash
7475
diff /dify/.env /dify/.env.example
7576
```
7677
</Step>
7778
<Step title="Start Services">
7879
```bash
79-
docker-compose pull
80-
docker-compose -f docker-compose.yaml -f docker-compose.override.yaml up -d
80+
docker compose pull
81+
docker compose -f docker-compose.yaml -f docker-compose.override.yaml up -d
8182
```
8283
</Step>
83-
</Steps>
84+
</Steps>

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

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Deploy Dify with Docker Compose
33
sidebarTitle: Docker Compose
4+
description: Install and start Dify Community Edition with Docker Compose
45
---
56

67
<Tip>
@@ -18,11 +19,11 @@ Make sure your machine meets the following minimum system requirements.
1819

1920
### Software
2021

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). |
22+
| Operating System | Required Software | Notes |
23+
| :----------------------------- | :---------------------------------------- | :----- |
24+
| 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/). |
25+
| 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/). |
26+
| 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). |
2627

2728

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

4849
```bash
49-
cp .env.example .env
50+
cp .env.example .env
5051
```
5152

52-
3. Start the containers using the command that matches your Docker Compose version:
53+
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.
5354

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>
55+
3. Start the containers:
56+
57+
```bash
58+
docker compose up -d
59+
```
6260

6361
<Tip>
64-
Run `docker compose version` to check your Docker Compose version.
62+
Dify uses optional Compose `env_file` entries. Run `docker compose version` and make sure your Docker Compose version is 2.24.0 or later.
6563
</Tip>
6664

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

138136
## Customize
139137

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

142140
```bash
143141
docker compose down
144142
docker compose up -d
145143
```
146144

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

155161
<Note>
156162

157-
After upgrading, check whether the `.env.example` file has changed and update your local `.env` file accordingly.
163+
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.
158164

159-
</Note>
165+
</Note>

en/self-host/troubleshooting/common-issues.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Common Issues
3+
description: Resolve common authentication, configuration, database, and workspace issues in self-hosted Dify
34
---
45

56
## Authentication & Access
@@ -41,7 +42,7 @@ EXPOSE_NGINX_PORT=80
4142
EXPOSE_NGINX_SSL_PORT=443
4243
```
4344

44-
For API service port changes, update the nginx configuration in `docker-compose.yaml`.
45+
For API service port changes, update the Nginx configuration under `docker/nginx/conf.d/`.
4546

4647
### Increase file upload limits
4748

@@ -91,7 +92,7 @@ Allow connections from the error's network segment:
9192

9293
```bash
9394
docker exec -it docker-db-1 sh -c "echo 'host all all 172.19.0.0/16 trust' >> /var/lib/postgresql/data/pgdata/pg_hba.conf"
94-
docker-compose restart
95+
docker compose restart
9596
```
9697

9798
### File not found error for encryption keys
@@ -125,4 +126,4 @@ Modify the `tenants` table in the database directly.
125126

126127
### Change application access domain
127128

128-
Update `APP_WEB_URL` in `docker-compose.yaml`.
129+
Update `APP_WEB_URL` in `.env`, then restart Dify.

en/self-host/troubleshooting/docker-issues.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Docker Issues
3+
description: Resolve common Docker Compose networking, volume, port, and container issues in self-hosted Dify
34
---
45

56
## Network & Connectivity
@@ -32,7 +33,7 @@ Example: For OpenLLM running on host, configure Dify with `http://192.168.1.100:
3233

3334
### Page loads forever with CORS errors
3435

35-
Domain/URL changes cause cross-origin issues. Update in `docker-compose.yml`:
36+
Domain or URL changes can cause cross-origin issues. Update these values in `.env`:
3637

3738
- `CONSOLE_API_URL` - Backend URL for console API
3839
- `CONSOLE_WEB_URL` - Frontend URL for console web
@@ -67,11 +68,7 @@ Port 80 already in use? Either:
6768
sudo service apache2 stop
6869
```
6970

70-
2. Or change port mapping in `docker-compose.yaml`:
71-
```yaml
72-
ports:
73-
- "8080:80" # Map to different port
74-
```
71+
2. Or change `EXPOSE_NGINX_PORT` in `.env`, then restart Dify.
7572

7673
## Container Management
7774

en/self-host/troubleshooting/storage-and-migration.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Storage & Migration
3+
description: Migrate vector databases, storage backends, and stored data in self-hosted Dify
34
---
45

56
## Vector Database Migration
@@ -13,9 +14,9 @@ title: Storage & Migration
1314
VECTOR_STORE=qdrant
1415
```
1516

16-
Docker Compose (`docker-compose.yaml`):
17-
```yaml
18-
VECTOR_STORE: qdrant
17+
Docker Compose (`.env`):
18+
```text
19+
VECTOR_STORE=qdrant
1920
```
2021

2122
2. **Run migration**
@@ -38,8 +39,8 @@ Migrate files from local storage to cloud providers (e.g., Alibaba Cloud OSS):
3839

3940
1. **Configure cloud storage**
4041

41-
`.env` or `docker-compose.yaml`:
42-
```
42+
`.env`:
43+
```text
4344
STORAGE_TYPE=aliyun-oss
4445
# Add OSS credentials
4546
```

en/self-host/troubleshooting/weaviate-v4-migration.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Weaviate Migration Guide upgrading to Client v4 and Server 1.27+
3+
description: Upgrade Weaviate server and migrate data for Dify deployments that use weaviate-client v4
34
---
45

56
> This guide explains how to migrate from Weaviate client v3 to v4.17.0 and upgrade your Weaviate server from version 1.19.0 to 1.27.0 or higher. This migration is required for Dify versions that include the weaviate-client v4 upgrade.
@@ -137,7 +138,7 @@ Restart Weaviate to apply the change:
137138
```bash
138139
cd docker
139140
docker compose down
140-
docker compose --profile up -d
141+
docker compose up -d
141142
sleep 10
142143
```
143144

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)