gpt4 book ai didi

apt-get update fails inside Dockerfile(APT-GET更新在Dockerfile内部失败)

转载 作者:bug小助手 更新时间:2023-10-25 09:23:43 29 4
gpt4 key购买 nike



When I try to build a simple docker image:

当我尝试构建一个简单的docker映像时:


in Dockerfile:

在Dockerfile中:


FROM ubuntu:18.04

RUN apt-get update

The output is:

输出为:


$ sudo docker build --no-cache -t testbuild .
Sending build context to Docker daemon 3.471MB
Step 1/2 : FROM ubuntu:18.04
---> c090eaba6b94
Step 2/2 : RUN apt-get update
---> Running in 53d64603442f
Ign:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Ign:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu bionic-security Release
404 Not Found [IP: 91.189.88.142 80]
Ign:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu bionic Release
404 Not Found [IP: 91.189.88.152 80]
Err:7 http://archive.ubuntu.com/ubuntu bionic-updates Release
404 Not Found [IP: 91.189.88.152 80]
Err:8 http://archive.ubuntu.com/ubuntu bionic-backports Release
404 Not Found [IP: 91.189.88.152 80]
Reading package lists...
E: The repository 'http://security.ubuntu.com/ubuntu bionic-security Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports Release' does not have a Release file.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100

I tried:

我试过:



  1. build with different types of ubuntu images - e.g. ubuntu:16.04, 18.04,20.04 - and get a similar error '...Release' does not have a Release file.'



  2. I completely removed and reinstalled docker from my system, inc all containers and repository, and rebooted, and get the same error




I previously built multiple docker images and everything worked fine. And now I get this error out of nowhere all the time.

我之前构建了多个docker映像,一切都运行得很好。而现在,我总是会突然发现这个错误。


更多回答

Hi @GAD3R - yes it is docker-ce

Hi@GAD3R-是的,我是docker-ce

Not as far as I'm aware and as far as I have checked (although im using a university network).

据我所知和据我所知没有(尽管我使用的是大学网络)。

One thing I noted is that docker ubuntu date gives UTC time, while my local timezone is EST (UTC-5). I had tried changing this with various methods, but the same error still persists. e.g. i found similar issue here

我注意到的一件事是,码头上的ubuntu日期是UTC时间,而我所在的当地时区是美国东部夏令时(UTC-5)。我曾尝试使用各种方法来更改这一点,但相同的错误仍然存在。我在这里发现了类似的问题

Try adding RUN echo "Your-TimeZone" > /etc/timezone and RUN dpkg-reconfigure -f noninteractive tzdata before apt update.

尝试在APT更新之前添加run echo“Your-timezone”>/etc/timezone并运行dpkg-reconfiguration-f非交互tzdata。

to sync the clock I did this: 1. Build a 1 line container FROM ubuntu (i.e. no other commands) 2. run the container with copy of time from the local machine - docker run -it --rm -v /etc/localtime:/etc/localtime testbuilt /bin/bash. 3. Check time by running date (time is now corrected) 4. Try apt-get update from within the container - but the same error persists (does not have a Release file) - so I know the problem is not with time difference..

为了同步时钟,我这样做了:1.从ubuntu构建一个1行的容器(即没有其他命令)2.使用本地机器的时间副本运行容器-docker run-it--rm-v/etc/localtime:/etc/Localtime TestBuild/bin/bash。3.通过运行日期检查时间(现在时间已更正)4.尝试apt-从容器中获取更新-但相同的错误仍然存在(没有发布文件)-所以我知道问题不是时差。

优秀答案推荐

I know this is an old question but I encountered this today, too. For me the "solution" was to use a newer image...

我知道这是一个老问题,但我今天也遇到了这个问题。对我来说,“解决方案”是使用一种更新的形象。


I was using ubuntu:21.04 and getting this error, while ubuntu:22.04 with no other changes did not give the error.

我正在使用ubuntu:21.04并得到这个错误,而没有其他更改的ubuntu:22.04没有给出这个错误。


更多回答

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com