离线安装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​.

相关推荐
Archy_Wang_127 分钟前
LVS+KeepAlived+Nginx实现企业级业务高可靠部署的实战教程
运维·nginx·lvs
张文君2 小时前
docker使用代理拉取镜像
运维·docker·容器
ltl3 小时前
纠删码原理与存储效率
linux
ltl3 小时前
MinIO 原理和架构:机制、AGPL 与上游 archived 风险
linux
陌路203 小时前
Docker教程从入门到精通(0基础)
运维·docker·容器
林浩杨_3 小时前
linux搜索命令(grep+sed)
linux·命令模式
W.W.H.3 小时前
将驱动编译成模块并安装到rootfs
linux·物联网·wifi·rootfs·驱动
ltl3 小时前
io_uring 在生产环境翻车实录:内核 bug、资源泄漏和你不知道的限制
linux
ltl3 小时前
内存分配器擂台:jemalloc vs tcmalloc vs mimalloc vs glibc
linux
ltl3 小时前
Zero Copy 的肮脏秘密:在什么时候反而更慢
linux