尝试构建Docker Image(在运行APT-GET更新时)时无法获取错误

发布于 2025-02-10 11:53:22 字数 1365 浏览 0 评论 0原文

我正在尝试创建一个烧瓶垃圾项目,但我还需要Linux的一些工具。 所以我有一个debian:我想安装的dockerfile的最新基础图像 Python3和Dieharder(我为项目所需的包装)。 但是每次我尝试使用以下命令构建图像: Docker build -no -cache -pull -T后端。 我得到了3个未能获取的软件包:

E: Failed to fetch http://deb.debian.org/debian/pool/main/g/gcc-defaults/gcc_10.2.1-1_amd64.deb  Bad header line Bad header data [IP: 151.101.14.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/g/gcc-defaults/g%2b%2b_10.2.1-1_amd64.deb  Bad header line Bad header data [IP: 151.101.14.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update --fix-missing -y && apt-get install -y python3-pip && apt-get install -y dieharder' returned a non-zero code: 100

我已经在一个run命令中运行所有内容,也可以使用-NO-CACHE,但我仍然 得到这些错误。另外,我找不到其他人遇到这些特定错误的人。 因此,我要您提供帮助,因为我不知道我还能做什么。

我的Dockerfile:

FROM debian:latest

RUN apt-get update --fix-missing -y && apt-get install -y python3-pip && apt-get install -y dieharder

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

ENTRYPOINT [ "python" ] 

CMD ["main.py"]

可能是一个问题,即我在VM上完成所有这些工作吗?还有进一步的信息吗 你需要帮我吗?请让我知道,这是我有史以来的第一个问题,所以如果不是那么好,请肯定:) PS我真的不需要使用Debian作为基本图像,但我更喜欢。我还尝试了Ubuntu并遇到了同样的错误,所以我认为这不是问题。

I'm trying to create a flask-docker project, but i also need some tools from linux.
So i have a debian:latest base image for my dockerfile, in which i want to install
python3 and dieharder(the package i need for my project).
But every time i try to build the image with following command:
docker build --no-cache --pull -t backend .
I get 3 packages that fail to fetch:

E: Failed to fetch http://deb.debian.org/debian/pool/main/g/gcc-defaults/gcc_10.2.1-1_amd64.deb  Bad header line Bad header data [IP: 151.101.14.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/g/gcc-defaults/g%2b%2b_10.2.1-1_amd64.deb  Bad header line Bad header data [IP: 151.101.14.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update --fix-missing -y && apt-get install -y python3-pip && apt-get install -y dieharder' returned a non-zero code: 100

I'm already running everything in one RUN command and also using --no-cache, but i still
get these errors. Also i could'nt find anyone else with these specific errors.
So i'm asking for Your help, because i don't know what else i can do.

My Dockerfile:

FROM debian:latest

RUN apt-get update --fix-missing -y && apt-get install -y python3-pip && apt-get install -y dieharder

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

ENTRYPOINT [ "python" ] 

CMD ["main.py"]

Could it be a problem that im doing all this on a VM? Is there any further information
you need to help me? Please let me know, this is my first question ever, so sry if it's not that good :)
P.S. i don't really need to use debian as a base image but i would prefer to. I also tried Ubuntu and got the same error, so i don't think that thats the problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

且行且努力 2025-02-17 11:53:22

更新:
似乎我解决了这个问题,尽管我不确定为什么现在可以工作。
我必须更改运行命令,并独立于安装GCC和G ++
apt-get更新。我不知道这是否是一个优雅的解决方案,但现在起作用。
如果有人有一个更顺畅的解决方案,请让我知道:)
无论如何,这是我的最终Dockerfile:

FROM debian:latest

RUN apt-get update -y && apt-get install gcc-10 -y && apt-get install g++-10 -y && apt-get install -y python3-pip && apt-get install -y dieharder

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

ENTRYPOINT [ "python3" ] 

CMD ["main.py"]

Update:
It seems like i solved this problem, although I'm not really sure why it works now.
I had to change my run command and install gcc and g++ independently from
apt-get update. I don't know if this is an elegant solution, but it works for now.
If anyone has a smoother solution pls let me know :)
Anyway here is my final Dockerfile:

FROM debian:latest

RUN apt-get update -y && apt-get install gcc-10 -y && apt-get install g++-10 -y && apt-get install -y python3-pip && apt-get install -y dieharder

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

ENTRYPOINT [ "python3" ] 

CMD ["main.py"]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文