![E: 使用 Docker 执行脚本 APT::Update 时出现问题](https://linux22.com/image/1188256/E%3A%20%E4%BD%BF%E7%94%A8%20Docker%20%E6%89%A7%E8%A1%8C%E8%84%9A%E6%9C%AC%20APT%3A%3AUpdate%20%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
尝试构建以下docker镜像:
FROM ubuntu:22.04
RUN apt-get update
...
使用以下命令:
sudo docker build -t ubuntu22 .
但得到:
Fetched 22.0 MB in 2s (11.8 MB/s)
Reading package lists...
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
什么可能出错?
答案1
我有同样的问题。我用过,FROM ubuntu:21.10
但构建结果
Ign:1 http://archive.ubuntu.com/ubuntu impish InRelease
Ign:2 http://security.ubuntu.com/ubuntu impish-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu impish-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu impish-security Release
404 Not Found [IP: ***]
Ign:5 http://archive.ubuntu.com/ubuntu impish-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu impish Release
404 Not Found [IP: ***]
Err:7 http://archive.ubuntu.com/ubuntu impish-updates Release
404 Not Found [IP: ***]
Err:8 http://archive.ubuntu.com/ubuntu impish-backports Release
404 Not Found [IP: ***]
Reading package lists...
E: The repository 'http://security.ubuntu.com/ubuntu impish-security Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu impish Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu impish-updates Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu impish-backports Release' does not have a Release file.
“Ubuntu 21.10 (Impish Indri) 将于 2022 年 7 月 14 日终止生命周期”。
然后我将 21.10 更改为 22.04 并运行构建(在 apt-get update 之后)
Reading package lists...
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
编辑:然后我更改了以前的 LTS 版本(FROM ubuntu:20.04),一切正常