在 Gitee 或 GitCode 上克隆 Dify 项目源码并启动 Docker 环境

在 Gitee 或 GitCode 上克隆 Dify 项目源码并启动 Docker 环境

第一步:克隆源码仓库

首先,使用以下命令将项目克隆到本地,确保您已经在 Gitee 或 GitCode 上配置了 SSH 密钥:

bash 复制代码
git clone git@gitcode.com:Mingcai_Xiong/dify-copy-github.git

完成克隆后,进入项目目录:

bash 复制代码
cd ~/dify-copy-github/docker

第二步:下载 Dify 所需的 Docker 镜像

在拉取镜像之前,建议您配置 Docker 的镜像加速,以加快下载速度。打开或创建 /etc/docker/daemon.json 文件,添加如下内容:

json 复制代码
{
  "registry-mirrors": [
    "https://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn",
    "https://ueo0uggy.mirror.aliyuncs.com",
    "https://docker.m.daocloud.io",
    "https://cf-workers-docker-io-apl.pages.dev",
    "http://95.169.25.181"
  ],
  "insecure-registries" : ["124.222.237.211:5000"]
}

保存后,重启 Docker 服务:

bash 复制代码
sudo systemctl restart docker

接下来,您可以使用以下命令查看 docker-compose.yaml 中需要拉取的镜像:

bash 复制代码
cat docker-compose.yaml | grep 'image:'

输出示例:

bash 复制代码
image: langgenius/dify-web:0.10.0
image: postgres:15-alpine
image: redis:6-alpine
image: langgenius/dify-sandbox:0.2.10
image: ubuntu/squid:latest
image: certbot/certbot
image: nginx:latest
image: semitechnologies/weaviate:1.19.0
image: langgenius/qdrant:v1.7.3
......

现在,您可以拉取所有这些镜像:

bash 复制代码
docker compose pull

第三步:启动项目

  1. 复制环境配置文件:
bash 复制代码
cp .env.example .env
  1. 启动 Docker 容器:
bash 复制代码
docker compose up -d

此命令将在后台启动所有定义的服务。如果您只想构建特定服务(如 nginx),且不想重新构建其依赖项,可以使用以下命令:

bash 复制代码
docker compose up -d --build --no-deps nginx
参数解释
  • --build:强制重新构建镜像,即使镜像已经存在。
  • --no-deps:不启动此服务的依赖项,仅启动指定的服务。

总结

通过上述步骤,您已经成功地克隆了 Dify 的源码、配置了 Docker 镜像加速、拉取了所需的镜像并启动了项目。

相关推荐
unable code1 天前
磁盘取证-Flying_High
网络安全·ctf·misc·1024程序员节·磁盘取证
unable code2 天前
磁盘取证-ColorfulDisk
网络安全·ctf·misc·1024程序员节·内存取证
unable code3 天前
磁盘取证-[第十章][10.1.2 磁盘取证方法]磁盘取证1
网络安全·ctf·misc·1024程序员节·内存取证
开开心心就好5 天前
免费抽奖工具支持批量导入+自定义主题
linux·运维·服务器·macos·pdf·phpstorm·1024程序员节
开开心心就好9 天前
卸载工具清理残留,检测垃圾颜色标识状态
linux·运维·服务器·python·安全·tornado·1024程序员节
子燕若水10 天前
Facebook reels 运营指南
1024程序员节
尘觉13 天前
创作 1024 天|把热爱写成长期主义
数据库·1024程序员节
写点什么呢14 天前
Word使用记录
word·1024程序员节
开开心心就好14 天前
内存清理工具点击清理,自动间隔自启
linux·运维·服务器·安全·硬件架构·材料工程·1024程序员节
开开心心就好14 天前
内存清理工具开源免费,自动优化清理项
linux·运维·服务器·python·django·pdf·1024程序员节