Dockerfile 内 apt-get 更新失败

问题描述 投票:0回答:1

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

在 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

我尝试过:

  1. 使用不同类型的 ubuntu 镜像构建 - 例如ubuntu:16.04, 18.04,20.04 - 并收到类似的错误“...Release”没有发布文件。'

  2. 我从系统中完全删除并重新安装了 docker,包括所有容器和存储库,然后重新启动,并得到相同的错误

我之前构建了多个 docker 镜像,一切正常。现在我总是莫名其妙地遇到这个错误。

linux docker ubuntu apt-get
1个回答
0
投票

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

我正在使用

ubuntu:21.04
并收到此错误,而
ubuntu:22.04
没有其他更改则没有给出错误。

© www.soinside.com 2019 - 2024. All rights reserved.