> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker Compose

## 环境要求

* Docker
* Docker Compose
* Linux 服务器
  * Docker Desktop 不支持在 Windows 和 Mac 上使用。
  * 最低配置：4 核 CPU，16 GB 内存，100 GB 磁盘空间。

## 快速开始

### 下载

从 Dify Enterprise [官方发布页面](https://langgenius.github.io/dify-enterprise-docker-compose/) 下载指定版本。请将 `<version>` 替换为你需要下载的具体版本号，例如 `1.0.0`。

使用 wget：

```bash theme={null}
wget https://langgenius.github.io/dify-enterprise-docker-compose/dify-docker-compose-<version>.tgz
```

使用 curl：

```bash theme={null}
curl -O https://langgenius.github.io/dify-enterprise-docker-compose/dify-docker-compose-<version>.tgz
```

## 安装步骤

1. 将下载的压缩包解压至部署目录。

   ```bash theme={null}
   mkdir dify-enterprise
   tar -xzf dify-docker-compose-<version>.tgz -C ./dify-enterprise/
   ```

2. 启动 docker compose。

   ```bash theme={null}
   cd dify-enterprise
   docker compose up -d
   ```

3. [访问 Dify Enterprise 的方法](#dify-enterprise)。

4. [验证 Dify 服务状态](/zh/2.7.x/deploy/verify-services-status)（用于检查 Dify Enterprise 的各项服务是否正常运行）。

5. [激活许可证](/zh/2.7.x/deploy/license-activation)（用于激活 Dify Enterprise 的许可证）。

## 从社区版升级

1. 创建企业版数据库（需确保社区版已启动）。

   ```bash theme={null}
   docker exec -it dify-db-1 psql -U postgres -c "CREATE DATABASE enterprise;"
   ```

   **提示：** 建议根据实际运行的容器名称进行调整。使用 `docker container ls` 找到 `db` 服务的名称。

2. 关闭社区版。

   ```bash theme={null}
   docker compose down
   ```

3. 备份你的数据和设置（根据你的系统配置，可能需要使用 `sudo` 命令）。

   ```bash theme={null}
   tar -czf backup.tgz volumes .env # 如果还有其他自定义文件和文件夹，请自行添加。
   ```

4. 保留 `backup.tgz` 和 `dify-docker-compose-<version>.tgz` 文件，删除其余所有社区版文件和文件夹。

5. 将下载的压缩包解压到你的部署目录。

   ```bash theme={null}
   tar -xzf dify-docker-compose-<version>.tgz -C /path/to/directory
   ```

6. 恢复你的备份，**为了避免冲突**，先删除 `volumes` 文件夹。

   ```bash theme={null}
   rm -rf volumes
   ```

   然后运行：

   ```bash theme={null}
   tar -xzf backup.tgz
   ```

7. 如果存在自定义配置文件（如 `docker-compose.yaml`、`ssrf_proxy/squid.conf` 或 `nginx/conf.d/default.conf`），请根据需要更新这些文件，以确保配置一致。

8. 启动 docker compose。

   ```bash theme={null}
   docker compose up -d
   ```

9. [访问 Dify Enterprise 的方法](#dify-enterprise)。

10. [验证 Dify 服务状态](/zh/2.7.x/deploy/verify-services-status)（用于检查 Dify Enterprise 的各项服务是否正常运行）。

11. [激活许可证](/zh/2.7.x/deploy/license-activation)（用于激活 Dify Enterprise 的许可证）。

## 从之前的企业版升级

1. 备份你的数据和设置（根据你的系统配置，可能需要使用 `sudo` 命令）。

   ```bash theme={null}
   tar -czf backup.tgz volumes .env # 如果还有其他自定义文件和文件夹，请添加
   ```
