如何离线安装dify

如何离线安装dify

如何离线安装dify

思路是:在可以联网的服务器上运行Dify,使用docker ps指令查看dify运行后启动的哪些容器(不同的Dify版本依赖的镜像版本也不同,根据实际情况):

容器 镜像
docker-nginx-1 nginx:latest
docker-worker-1 langgenius/dify-api:1.11.3
docker-worker_beat-1 langgenius/dify-api:1.11.3
docker-api-1 langgenius/dify-api:1.11.3
docker-plugin_daemon-1 langgenius/dify-plugin-daemon:0.5.2-local
docker-web-1 langgenius/dify-web:1.11.3
docker-ssrf_proxy-1 ubuntu/squid:latest
docker-weaviate-1 semitechnologies/weaviate:1.27.0
docker-redis-1 redis:6-alpine
docker-sandbox-1 langgenius/dify-sandbox:0.2.12
python 复制代码
docker save \
  -o dify-1.11.3-images.tar \
  langgenius/dify-api:1.11.3 \
  langgenius/dify-web:1.11.3 \
  langgenius/dify-plugin-daemon:0.5.2-local \
  langgenius/dify-sandbox:0.2.12 \
  semitechnologies/weaviate:1.27.0 \
  redis:6-alpine \
  nginx:latest \
  ubuntu/squid:latest

得到如下文件:

在另一台离线机器上如何恢复

python 复制代码
docker load -i dify-1.11.3-images.tar

查看

然后去该网站下载相关的依赖插件:

python 复制代码
https://marketplace.dify.ai/

将要下载的插件保存到本地!!!

2、停止服务和备份数据

python 复制代码
cd dify/docker
docker compose down
python 复制代码
# 拷贝相关的配置文件与dify数据
cp docker-compose.yaml docker-compose.yaml.$(date +%s).bak  #备份yaml 文件
cp .env .env.$(date +%s).bak
tar -cvf volumes-$(date +%s).tgz volumes  #备份dify 数据,数据在volums 目录

然后去Dify官网下载要升级版本的dify源码

python 复制代码
https://github.com/langgenius/dify/releases/tag/1.11.3

3、数据还原到新分支目录下

python 复制代码
unzip dify-1.11.3.zip
cd dify-1.11.3/docker/
# 拷贝数据配置.env 文件
cp /root/dify-main/docker/.env /root/dify-1.11.3/docker/.env
# 数据拷贝从之前备份的1.6.0版本的volumes拷贝到1.7.1版本的docker目录并解压覆盖volumes 
cp /root/dify-main/docker/volumes-1754288506.tgz /root/dify-1.11.3/docker
tar -xvf volumes-1754288506.tgz volumes

4、启动验证服务

python 复制代码
docker compose up  #拉取升级后的相关镜像

自己备忘录:

Dify1.11.3版本还需要修改.env文件:

由:

改为:

python 复制代码
# ------------------------------
# Database Configuration
# The database uses PostgreSQL. Please use the public schema.
# It is consistent with the configuration in the 'db' service below.
# ------------------------------

DB_USERNAME=postgres
DB_PASSWORD=difyai123456
DB_HOST=db_postgres
DB_PORT=5432
DB_DATABASE=dify
# The size of the database connection pool.
# The default is 30 connections, which can be appropriately increased.
SQLALCHEMY_POOL_SIZE=30
# Database connection pool recycling time, the default is 3600 seconds.
SQLALCHEMY_POOL_RECYCLE=3600
# Whether to print SQL, default is false.
SQLALCHEMY_ECHO=false

如果在启动时发现有漏打的镜像依赖,可以通过如下指令查询:

python 复制代码
docker-compose --profile postgresql config | grep image
python 复制代码
docker compose --profile postgresql up -d
python 复制代码
docker compose logs -f dify-api
相关推荐
rising start1 小时前
Dify在Windows上的部署
大模型·agent·dify
dtsola2 天前
小遥搜索v1.7.0版本更新【飞书文档+知识库支持】
程序员·飞书·dify·ai智能体·独立开发者·vibecoding·一人公司
Arvin_Rong4 天前
Dify Http节点 Text size is too large max size is 1.00 MB错误
dify
handsomestWei4 天前
dify使用简介
工作流·dify·智能体
程序员柒叔5 天前
Dify 一周动态-2026-W14
人工智能·大模型·github·工作流·dify
YoanAILab6 天前
从 CoT、RAG 到 Dify、Deep Research:一篇讲清 AI 问答系统的两条进化路线
人工智能·cot·dify·rag·deepresearch
冷色系里的一抹暖调7 天前
Dify 插件离线打包完整指南(Windows + Docker 版)
docker·ai·dify
前进的李工7 天前
SSH隧道实现Dify与Ollama跨服务器通信
开发语言·大模型·github·腾讯云·autodl·dify
Thomas.Sir7 天前
第八章:RAG知识库开发之【Dify 实现数据库数据智能查询系统:从零构建企业级自然语言查询助手】
数据库·python·ai·dify
Thomas.Sir8 天前
第七章:RAG知识库开发之【RAG开源应用完全解析:从RAGFlow到Dify的实战指南】
人工智能·python·开源·fastgpt·dify·ragflow