Dify Docker#
生成式 AI 应用创新引擎
开源的 LLM 应用开发平台。提供从 Agent 构建到 AI workflow 编排、RAG 检索、模型管理等能力,轻松构建和运营生成式 AI 原生应用。 比 LangChain 更易用。
Docker Compose#
git clone https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
docker-compose up -d
访问 Dify#
更新 Dify#
# 1. Back up your customized docker-compose YAML file (optional)
cd dify/docker
cp docker-compose.yaml docker-compose.yaml.$(date +%s).bak
# 2. Get the latest code from the main branch
git checkout main
git pull origin main
# 3. Stop the service, Command, please execute in the docker directory
docker compose down
# 4. Back up data
tar -cvf volumes-$(date +%s).tgz volumes
# 5. Upgrade services
docker compose pull
docker compose up -d
同步环境变量配置 (重要!)#
如果 .env.example
文件有更新,请务必同步修改你本地的 .env
文件。
自定义配置#
编辑 .env
文件中的环境变量值。然后重新启动 Dify:
docker compose down
docker compose up -d
完整的环境变量集合可以在 docker/.env.example
中找到。
单独启动前端 Docker 容器#
当单独开发后端时,可能只需要源码启动后端服务,而不需要本地构建前端代码并启动
docker run -it -p 3000:3000 -e CONSOLE_API_URL=http://127.0.0.1:5001 -e APP_API_URL=http://127.0.0.1:5001 langgenius/dify-web:latest
Tips#
环境变量配置#
vi .env
NGINX_CLIENT_MAX_BODY_SIZE=500M
UPLOAD_FILE_SIZE_LIMIT=500
PIP_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple
备份#
需要备份数据库、配置的存储以及向量数据库数据,若为 docker compose 方式部署,可直接备份 dify/docker/volumes
目录下所有数据内容。
dify-sandbox config error#
cd volumes/sandbox/conf
wget https://github.com/langgenius/dify/blob/main/docker/volumes/sandbox/conf/config.yaml
dify-sandbox ModuleNotFoundError#
cd volumes/sandbox/dependencies
vi python-requirements.txt
weaviate组件缺失问题#
docker-compose up weaviate -d