1.克隆 Dify 代码仓库
# 假设当前最新版本为 0.15.3
git clone https://github.com/langgenius/dify.git --branch 0.15.3
2.启动 Dify
- 进入 Dify 源代码的 Docker 目录
cd dify/docker
- 复制环境配置文件
cp .env.example .env
3.启动 Docker 容器 根据你系统上的 Docker Compose 版本,选择合适的命令来启动容器
如果版本是 Docker Compose V2,使用以下命令:
docker compose up -d
如果版本是 Docker Compose V1,使用以下命令:
docker-compose up -d
解决连接不上docker仓库问题
vim /etc/docker/daemon.json
//如果这个文件没有就手动创建
{
"registry-mirrors" : ["https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc",
"https://do.nark.eu.org",
"https://dc.j8.work",
"https://dockerproxy.com",
"https://gst6rzl9.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"http://mirrors.ustc.edu.cn/",
"https://mirrors.tuna.tsinghua.edu.cn/",
"http://mirrors.sohu.com/"
],
"insecure-registries" : [
"registry.docker-cn.com",
"docker.mirrors.ustc.edu.cn"
],
"debug": true,
"experimental": false
}
重载生效
sudo systemctl daemon-reload
重启服务
sudo systemctl restart docker
启动完成后
4.更新 Dify
cd dify/docker
docker compose down
git pull origin main
docker compose pull
docker compose up -d
同步环境变量配置 (重要!)
- 如果
.env.example
文件有更新,请务必同步修改你本地的.env
文件。 - 检查
.env
文件中的所有配置项,确保它们与你的实际运行环境相匹配。你可能需要将.env.example
中的新变量添加到.env
文件中,并更新已更改的任何值。
5.访问 Dify
初始化管理员用户
# 本地环境
http://localhost/install
# 服务器环境
http://your_server_ip/install
Dify主页面
# 本地环境
http://localhost
# 服务器环境
http://your_server_ip