From 264910ea4ef41c7976c10770499fe018be173213 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Mon, 4 Aug 2025 20:52:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(docker):=20=E7=A7=BB=E9=99=A4Dockerfil?= =?UTF-8?q?e=E4=B8=AD=E7=9A=84=E4=BB=A3=E7=90=86=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 代理设置已不再需要,简化构建环境配置 --- README.md | 13 +++++++++++++ docker/api.Dockerfile | 10 +++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8e92eef4..8c0be4c9 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,19 @@ https://github.com/user-attachments/assets/15f7f315-003d-4e41-a260-739c2529f824 docker load -i docker_images_xxx.tar ``` +
+ 镜像拉取完成,但是构建失败 + +如果拉取镜像完成,但是构建失败,基本都是因为依赖的镜像问题,可以尝试修改 `docker/api.Dockerfile` (第 31 行左右)中的环境变量,替换为本机的代理地址后,尝试构建。 + +```dockerfile +# 安装依赖项,如果无法成功安装,则尝试是设置此处的代理 +ENV HTTP_PROXY=http://IP:PORT \ + HTTPS_PROXY=http://IP:PORT \ + http_proxy=http://IP:PORT \ + https_proxy=http://IP:PORT +``` +
Milvus 启动失败,执行 `docker compose up milvus -d && docker restart api-dev` diff --git a/docker/api.Dockerfile b/docker/api.Dockerfile index ea5779c7..d0ca91a1 100644 --- a/docker/api.Dockerfile +++ b/docker/api.Dockerfile @@ -28,11 +28,11 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone & COPY ../pyproject.toml /app/pyproject.toml COPY ../.python-version /app/.python-version -# 安装依赖项 -ENV HTTP_PROXY=http://172.19.13.5:7890 \ - HTTPS_PROXY=http://172.19.13.5:7890 \ - http_proxy=http://172.19.13.5:7890 \ - https_proxy=http://172.19.13.5:7890 +# 安装依赖项,如果无法成功安装,则尝试是设置此处的代理 +# ENV HTTP_PROXY=http://172.19.13.5:7890 \ +# HTTPS_PROXY=http://172.19.13.5:7890 \ +# http_proxy=http://172.19.13.5:7890 \ +# https_proxy=http://172.19.13.5:7890 RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --no-install-project