【瞎折腾/Dify】使用docker离线部署Dify

文章目录

说在前面

  • 外网操作系统:windows
  • 内网操作系统:ubuntu
  • 外网docker desktop版本:4.29.0
  • 外网docker版本:version 26.0.0, build 2ae903e
  • 内网docker版本:version 26.1.3, build 2ae903e
  • dify版本:0.15.3

安装Docker

  • 外网
    如果是windows,建议使用wsl2 backend
  • 内网
    如果是windows,建议和外网保持一致

(外网)获取Dify源码

  • github

    shell 复制代码
    git clone https://github.com/langgenius/dify.git --branch 0.15.3

(外网)拉取docker镜像

  • 如果是新版本的docker desktop,直接使用docker compose up即可

    shell 复制代码
    D:\Code>cd dify\docker
    D:\Code\dify\docker>docker compose up -d
    [+] Running 75/23
     ✔ db Pulled                                                                                                     335.0s
     ✔ web Pulled                                                                                                    523.7s
     ✔ nginx Pulled                                                                                                  423.3s
     ✔ api Pulled                                                                                                    705.3s
     ✔ weaviate Pulled                                                                                                47.3s
     ✔ worker Pulled                                                                                                 705.3s
     ✔ ssrf_proxy Pulled                                                                                             379.1s
     ✔ sandbox Pulled                                                                                                123.6s
     ✔ redis Pulled                                                                                                   61.2s
    [+] Running 11/11
     ✔ Network docker_ssrf_proxy_network  Created                                                                      0.0s
     ✔ Network docker_default             Created                                                                      0.1s
     ✔ Container docker-weaviate-1        Started                                                                     78.7s
     ✔ Container docker-redis-1           Started                                                                     78.7s
     ✔ Container docker-sandbox-1         Started                                                                     78.7s
     ✔ Container docker-web-1             Started                                                                     55.2s
     ✔ Container docker-db-1              Started                                                                     78.7s
     ✔ Container docker-ssrf_proxy-1      Started                                                                     78.7s
     ✔ Container docker-worker-1          Started                                                                     35.4s
     ✔ Container docker-api-1             Started                                                                     35.5s
     ✔ Container docker-nginx-1           Started                                                                     66.2s
  • 执行完之后,dify其实已经部署好了

    shell 复制代码
    http://localhost

    直接访问即可

(外网)导出镜像

  • 然后我们使用docker命令将镜像导出,先查看一下有哪些镜像

    shell 复制代码
    D:\Code\dify\docker>docker images
    REPOSITORY                  TAG         IMAGE ID       CREATED         SIZE
    ubuntu/squid                latest      dae40da440fe   13 days ago     243MB
    postgres                    15-alpine   afbf3abf6aeb   2 weeks ago     273MB
    langgenius/dify-web         0.15.3      f0fae584255f   5 weeks ago     436MB
    langgenius/dify-api         0.15.3      e05373163e63   5 weeks ago     2.97GB
    nginx                       latest      b52e0b094bc0   5 weeks ago     192MB
    redis                       6-alpine    6dd588768b9b   2 months ago    30.2MB
    langgenius/dify-sandbox     0.2.10      4328059557e8   4 months ago    567MB
    semitechnologies/weaviate   1.19.0      8ec9f084ab23   22 months ago   52.5MB
  • 然后使用save命令将所有相关镜像导出

    shell 复制代码
    docker save -o dweb langgenius/dify-web:0.15.3

    注意不要直接使用IMAGE ID,不然导入的时候REPOSITORYTAG可能为none

(内网)导入镜像

  • 将上述导出的镜像文件导入到内网之后,再使用load命令导入

    shell 复制代码
    docker load -i weaviate.tar

    将所有镜像都导入

(内网)运行

  • 然后将Dify源码中的docker文件夹导入到内网中

    shell 复制代码
    cd docker\
    docker-compose up -d
    # 如果是新版的docker desktop
    # docker compose up -d
  • 浏览器访问即可

问题

  • Application error: a client-side exception has occurred (see the browser console for more information.
    打开控制台后:

    shell 复制代码
    Uncaught SyntaxError: Unexpected Token '{'

    内网如果浏览器比较老,可能某些前端版本不兼容,建议下个新版的浏览器试试

相关推荐
码龄3年 审核中17 小时前
说说SSH的端口转发
大数据·运维·ssh
盛世隐者17 小时前
【Linux】定制Linux系统
linux·运维·服务器
行思理18 小时前
Docker 应该如何学习 分四个阶段
学习·docker·容器
..Move...19 小时前
Docker应用部署tomcat和nginx
nginx·docker·tomcat
Lxt.星翊20 小时前
MySQL(安装和卸载、数据库存储原理图)
linux·运维·windows
苹果醋320 小时前
JAVA面试汇总(二)多线程(五)
运维·vue.js·spring boot·nginx·课程设计
JustNow_Man21 小时前
Cline中模型识别任务与clinerules相关性的实现逻辑
linux·运维·ubuntu
小白银子21 小时前
零基础从头教学Linux(Day 56)
linux·运维·python
你想考研啊21 小时前
Linux下搭建Activemq的Master-Slave(共享文件模式)
linux·运维·activemq
Teamhelper_AR1 天前
AR巡检系统:打开工业智能运维的下一幕
运维·ar