infiniflow/ragflow

[Bug]: docker build error

Closed this issue · 3 comments

Is there an existing issue for the same bug?

  • I have checked the existing issues.

RAGFlow workspace code commit ID

e267a02

RAGFlow image version

infiniflow/ragflow:dev latest version

Other environment information

NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Actual behavior

git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
pip3 install huggingface-hub nltk
python3 download_deps.py
docker build -f Dockerfile -t infiniflow/ragflow:dev .

I am following the above process and deploying ragflow:dev locally
When I ran to docker build, the script gave me an unexpected error. I couldn't find it in an existing issue

Expected behavior

No response

Steps to reproduce

git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
pip3 install huggingface-hub nltk
python3 download_deps.py
docker build -f Dockerfile -t infiniflow/ragflow:dev .

Additional information

[+] Building 74.6s (13/40) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 6.12kB 0.0s
=> [internal] load metadata for docker.io/infiniflow/ragflow_deps:latest 3.9s
=> [internal] load metadata for docker.io/library/ubuntu:22.04 1.6s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 70.64kB 0.1s
=> CACHED FROM docker.io/infiniflow/ragflow_deps:latest@sha256:86c04d288dcfe9e66af13cf1fa6c5b536ad9b513779a2b3bc8b2ea71a1122ab6 0.0s
=> [base 1/12] FROM docker.io/library/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97 0.0s
=> CACHED [base 2/12] WORKDIR /ragflow 0.0s
=> CACHED [base 3/12] RUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflow 0.0s
=> CACHED [base 4/12] RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/huggingface.co,target=/huggingface.co tar --exclude='.*' -cf - /huggingfa 0.0s
=> CACHED [base 5/12] RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/huggingface.co,target=/huggingface.co if [ "0" != "1" ]; then (tar -cf - 0.0s
=> CACHED [base 6/12] RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/,target=/deps cp -r /deps/nltk_data /root/ && cp /deps/tika-server-standard-3 0.0s
=> ERROR [base 7/12] RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked if [ "0" == "1" ]; then sed -i 's|http://archive.ubuntu.com|http 70.6s

[base 7/12] RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked if [ "0" == "1" ]; then sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list; fi; rm -f /etc/apt/apt.conf.d/docker-clean && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && apt update && apt --no-install-recommends install -y ca-certificates && apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget git nginx libgl1 vim less:
0.344
0.344 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.344
5.388 Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
5.388 Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
10.39 Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
16.40 Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
20.40 Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
23.40 Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
25.41 Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
35.42 Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
37.42 Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
37.42 Temporary failure resolving 'security.ubuntu.com'
40.42 Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
45.42 Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
50.43 Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
55.44 Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
60.44 Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
60.44 Temporary failure resolving 'archive.ubuntu.com'
65.45 Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
65.45 Temporary failure resolving 'archive.ubuntu.com'
70.45 Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
70.45 Temporary failure resolving 'archive.ubuntu.com'
70.46 Reading package lists...
70.48 Building dependency tree...
70.48 Reading state information...
70.48 All packages are up to date.
70.48 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease Temporary failure resolving 'archive.ubuntu.com'
70.48 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
70.48 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
70.48 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease Temporary failure resolving 'security.ubuntu.com'
70.48 W: Some index files failed to download. They have been ignored, or old ones used instead.
70.49
70.49 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
70.49
70.50 Reading package lists...
70.50 Building dependency tree...
70.51 Reading state information...
70.51 Package ca-certificates is not available, but is referred to by another package.
70.51 This may mean that the package is missing, has been obsoleted, or
70.51 is only available from another source
70.51
70.51 E: Package 'ca-certificates' has no installation candidate


Dockerfile:40

39 | # cv2 requires libGL.so.1
40 | >>> RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked
41 | >>> if [ "$NEED_MIRROR" == "1" ]; then
42 | >>> sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list;
43 | >>> fi;
44 | >>> rm -f /etc/apt/apt.conf.d/docker-clean &&
45 | >>> echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache &&
46 | >>> apt update &&
47 | >>> apt --no-install-recommends install -y ca-certificates &&
48 | >>> apt update &&
49 | >>> DEBIAN_FRONTEND=noninteractive apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx
50 | >>> libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget git nginx libgl1 vim less
51 |

ERROR: failed to solve: process "/bin/bash -c if [ "$NEED_MIRROR" == "1" ]; then sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list; fi; rm -f /etc/apt/apt.conf.d/docker-clean && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && apt update && apt --no-install-recommends install -y ca-certificates && apt update && DEBIAN_FRONTEND=noninteractive apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus default-jdk python3-pip pipx libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils unzip libgbm-dev wget git nginx libgl1 vim less" did not complete successfully: exit code: 100

This is not a bug. Your connection can not resolve the host archive.ubuntu.com
It is either your DNS which can not resolve the host, or your docker container/build cannot access the internet.
Try building it "--network=host" and/or try pinging archive.ubuntu.com to see if the host resolves and pings.

Yes, I tried adding --network=host parameter in docker build and it skipped the issue. Thank you very much

@BearCooike The procedure of building image has changed recently.
https://github.com/infiniflow/ragflow/blob/main/README_zh.md

本 Docker 镜像大小约 2 GB 左右并且依赖外部的大模型和 embedding 服务。
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
docker build --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim .