如何离线安装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
相关推荐
古斯塔夫歼星炮3 天前
Dify + Jenkins 实现AI应用持续集成与自动化部署
ci/cd·jenkins·dify
脑花儿4 天前
Dify平台聊天助手 API调用案例
api·postman·dify
勇气要爆发6 天前
2026年想学AI,面对 Dify、Coze、n8n、LangChain 该学哪个?
人工智能·langchain·dify·coze·n8n
冼紫菜11 天前
Claude整理的Dify平台学习教程资源
后端·学习·ai·llm·agent·dify
阿里-于怀13 天前
Dify 官方上架 Higress 插件,轻松接入 AI 网关访问模型服务
网络·人工智能·ai·dify·higress
kaizq13 天前
Windows下基于Python构造Dify可视应用环境[非Dock]
windows·python·dify·大语言模型llm·人工智能ai·智能体agent
赛博鲁迅15 天前
dify添加中转站模型教程
人工智能·gpt·aigc·ai编程·dify·ai-native
feasibility.16 天前
基于Qwen3-VL多模态嵌入/重排序模型+Dify(docker)工作流的电商图文检索系统
人工智能·docker·多模态·教育电商·dify·rag·智能体/工作流
腾飞开源20 天前
03_Dify 使用 Docker Compose 部署
环境配置·docker compose·dify·docker部署·容器化部署·ai开发平台·dify开源平台
Jastep20 天前
Dify本地化部署
ai·dify