当我尝试构建一个简单的Docker镜像时:
在Dockerfile中:
输出结果为:
我尝试过:
在Dockerfile中:
FROM ubuntu:18.04
RUN apt-get update
输出结果为:
$ 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
我尝试过:
使用不同类型的Ubuntu镜像构建,例如ubuntu:16.04、18.04、20.04等,并且遇到了相似的错误“...Release”没有Release文件。
我完全卸载并重新安装了我的系统中的docker,包括所有容器和存储库,并重新启动,但仍然出现相同的错误。
之前我构建了多个docker镜像,一切都很正常。现在我总是突然出现这个错误。
date
命令给出的时间是UTC时间,而我的本地时区是EST(UTC-5)。我尝试了各种方法来更改这个问题,但是同样的错误仍然存在。例如,我在这里找到了类似的问题。 - undefinedapt update
之前尝试添加RUN echo "Your-TimeZone" > /etc/timezone
和RUN dpkg-reconfigure -f noninteractive tzdata
。 - undefinedFROM ubuntu
(即没有其他命令);2. 运行容器,并从本地机器复制时间 -docker run -it --rm -v /etc/localtime:/etc/localtime testbuilt /bin/bash
;3. 通过运行date
命令来检查时间(现在时间已经修正);4. 尝试在容器内运行apt-get update
命令 - 但是仍然出现相同的错误(does not have a Release file
),所以我知道问题不是由于时间差异引起的。 - undefined