离线安装dify 1.7

OS

  • CentOS 7.6 min X86

安装包准备

Software Version Link
docker 25.0.0 https://download.docker.com/linux/static/stable/x86_64/docker-25.0.0.tgz
docker-compose-linux-x86_64

离线安装docker

参cdftcdcddocker 离线安装_离线docker安装包-CSDN博客

启动docker compose

docker compose 安装,启动

复制代码
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

dify离线镜像导出及导入

现有docker

复制代码
# docker ps |awk '{print $2}'
ID
nginx:latest
langgenius/dify-api:1.7.1
langgenius/dify-plugin-daemon:0.2.0-local
langgenius/dify-api:1.7.1
langgenius/dify-api:1.7.1
langgenius/dify-web:1.7.1
redis:6-alpine
langgenius/dify-sandbox:0.2.12
postgres:15-alpine
ubuntu/squid:latest
semitechnologies/weaviate:1.19.0

export

复制代码
docker save -o dify-api_171.tar langgenius/dify-api:1.7.1
docker save -o dify-plugin-daemon_020.tar langgenius/dify-plugin-daemon:0.2.0-local
docker save -o pg-15-alpine.tar postgres:15-alpine
docker save -o redis-6-alpine.tar redis:6-alpine
docker save -o dify-sandbox_212.tar langgenius/dify-sandbox:0.2.12
docker save -o dify-web_171.tar langgenius/dify-web:1.7.1
docker save -o weaviate_119.tar semitechnologies/weaviate:1.19.0
docker save -o squid.tar ubuntu/squid:latest
docker save -o nginx.tar nginx:latest

docker save -o dify-all-images.tar nginx:latest langgenius/dify-api:1.7.1 langgenius/dify-api:1.7.1 langgenius/dify-api:1.7.1 langgenius/dify-plugin-daemon:0.2.0-local langgenius/dify-sandbox:0.2.12 redis:6-alpine postgres:15-alpine ubuntu/squid:latest langgenius/dify-web:1.7.1 semitechnologies/weaviate:1.19.0

import

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

安装Dify

启动 Dify

  1. 进入 Dify 源代码的 Docker 目录

    复制代码
    cd dify/docker
  2. 复制环境配置文件

    复制代码
    cp .env.example .env

    主页报错error:修改配置文件 .env

    PLUGIN_S3_USE_AWS_MANAGED_IAM=false

    PLUGIN_S3_USE_PATH_STYLE=false

  3. 启动 Docker 容器

    根据你系统上的 Docker Compose 版本,选择合适的命令来启动容器。你可以通过 $ docker compose version​ 命令检查版本,详细说明请参考 Docker 官方文档

    复制代码
    docker-compose up -d

运行命令后,你应该会看到类似以下的输出,显示所有容器的状态和端口映射:

复制代码
[+] Running 11/11
 ✔ Network docker_ssrf_proxy_network  Created                                                                 0.1s 
 ✔ Network docker_default             Created                                                                 0.0s 
 ✔ Container docker-redis-1           Started                                                                 2.4s 
 ✔ Container docker-ssrf_proxy-1      Started                                                                 2.8s 
 ✔ Container docker-sandbox-1         Started                                                                 2.7s 
 ✔ Container docker-web-1             Started                                                                 2.7s 
 ✔ Container docker-weaviate-1        Started                                                                 2.4s 
 ✔ Container docker-db-1              Started                                                                 2.7s 
 ✔ Container docker-api-1             Started                                                                 6.5s 
 ✔ Container docker-worker-1          Started                                                                 6.4s 
 ✔ Container docker-nginx-1           Started                                                                 7.1s

最后检查是否所有容器都正常运行:

复制代码
docker compose ps

在这个输出中,你应该可以看到包括 3 个业务服务 api / worker / web​,以及 6 个基础组件 weaviate / db / redis / nginx / ssrf_proxy / sandbox​ 。

Copy

复制代码
NAME                  IMAGE                              COMMAND                   SERVICE      CREATED              STATUS                        PORTS
docker-api-1          langgenius/dify-api:0.6.13         "/bin/bash /entrypoi..."   api          About a minute ago   Up About a minute             5001/tcp
docker-db-1           postgres:15-alpine                 "docker-entrypoint.s..."   db           About a minute ago   Up About a minute (healthy)   5432/tcp
docker-nginx-1        nginx:latest                       "sh -c 'cp /docker-e..."   nginx        About a minute ago   Up About a minute             0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp
docker-redis-1        redis:6-alpine                     "docker-entrypoint.s..."   redis        About a minute ago   Up About a minute (healthy)   6379/tcp
docker-sandbox-1      langgenius/dify-sandbox:0.2.1      "/main"                   sandbox      About a minute ago   Up About a minute             
docker-ssrf_proxy-1   ubuntu/squid:latest                "sh -c 'cp /docker-e..."   ssrf_proxy   About a minute ago   Up About a minute             3128/tcp
docker-weaviate-1     semitechnologies/weaviate:1.19.0   "/bin/weaviate --hos..."   weaviate     About a minute ago   Up About a minute             
docker-web-1          langgenius/dify-web:0.6.13         "/bin/sh ./entrypoin..."   web          About a minute ago   Up About a minute             3000/tcp
docker-worker-1       langgenius/dify-api:0.6.13         "/bin/bash /entrypoi..."   worker       About a minute ago   Up About a minute             5001/tcp

通过这些步骤,你可以在本地成功安装 Dify。

更新 Dify

进入 dify 源代码的 docker 目录,按顺序执行以下命令:

复制代码
cd dify/docker
docker compose down
git pull origin main
docker compose pull
docker compose up -d
同步环境变量配置 (重要!)
  • 如果 .env.example 文件有更新,请务必同步修改你本地的 .env 文件。
  • 检查 .env 文件中的所有配置项,确保它们与你的实际运行环境相匹配。你可能需要将 .env.example 中的新变量添加到 .env 文件中,并更新已更改的任何值。

访问 Dify

你可以先前往管理员初始化页面设置设置管理员账户:

复制代码
# 本地环境
http://localhost/install

# 服务器环境
http://your_server_ip/install

Dify 主页面:

复制代码
# 本地环境
http://localhost

# 服务器环境
http://your_server_ip

自定义配置

编辑 .env​ 文件中的环境变量值。然后重新启动 Dify:

复制代码
docker compose down
docker compose up -d

完整的环境变量集合可以在 docker/.env.example​ 中找到。

Dify配置

If Dify is deployed using Docker, consider using the local network IP address, e.g., http://192.168.1.100:11434​ or http://host.docker.internal:11434​ to access the service.

For local source code deployment, use http://localhost:11434​.

相关推荐
云计算磊哥@2 小时前
运维开发宝典024-Linux云计算运维入门阶段总结
linux·运维·运维开发
江华森2 小时前
《Linux内核技术实战:从Page Cache到CPU调度的深度解构》博客大纲(26讲精编版)
linux
周小码2 小时前
10分钟搭建私有Git服务器:Soft Serve实战
运维·服务器·git
知无不研2 小时前
对套接字的深入理解
linux·服务器·网络·c++·socket·网络套接字
The Open Group2 小时前
从项目到产品:数字化转型为何进入“产品时代”?
运维
Urbano3 小时前
休闲束脚裤全生产工艺科普:从裁片到成衣,缝纫工序与自动化设备选型详解
运维·自动化
萤丰信息3 小时前
AI 重构园区运维|全场景无人化智慧运维:破解传统物业高成本痛点
运维·人工智能·重构
AI创界者4 小时前
运维进阶:如何使用 Medusa 进行企业内部服务器密码合规性审计?
运维·服务器
wuminyu4 小时前
Java锁机制之Java对象重量级锁源码剖析
java·linux·c语言·jvm·c++