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

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

相关推荐
对你无可奈何16 分钟前
高可用环境下Nginx服务管理脚本优化实践
linux·运维·nginx
张敬之、24 分钟前
k8s-dashboard
云原生·容器·kubernetes
云上艺旅25 分钟前
K8S学习之基础二十九:K8S中的secret
学习·云原生·容器·kubernetes
Justice link32 分钟前
K8S的搭建
云原生·容器·kubernetes
前端白袍43 分钟前
性能优化:服务器性能影响网站加载速度分析
运维·服务器·性能优化
stone08231 小时前
ABAP语言的动态编程(4) - 综合案例:管理费用明细表
linux·运维·服务器
厂里英才2 小时前
docker无法正常拉取镜像问题的解决
linux·docker
ღ星ღ2 小时前
网络编程基础
运维·服务器·网络
过客WZX2 小时前
Ubuntu24.04下管理自己的ssh连接
运维·服务器·ssh
RedCong3 小时前
K8S之QoS详解
云原生·容器·kubernetes