【瞎折腾/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 '{'

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

相关推荐
蓁蓁啊2 小时前
GIT使用SSH 多账户配置
运维·git·ssh
程序猿小三4 小时前
Linux下基于关键词文件搜索
linux·运维·服务器
虚拟指尖5 小时前
Ubuntu编译安装COLMAP【实测编译成功】
linux·运维·ubuntu
椎4956 小时前
苍穹外卖前端nginx错误之一解决
运维·前端·nginx
刘某的Cloud6 小时前
parted磁盘管理
linux·运维·系统·parted
极验6 小时前
iPhone17实体卡槽消失?eSIM 普及下的安全挑战与应对
大数据·运维·安全
爱倒腾的老唐6 小时前
24、Linux 路由管理
linux·运维·网络
yannan201903136 小时前
Docker容器
运维·docker·容器
_清浅6 小时前
计算机网络【第六章-应用层】
运维·服务器·计算机网络
正在努力的小河6 小时前
Linux 自带的 LED 灯驱动实验
linux·运维·服务器