存储库未在 docker build 中登录

新手上路,请多包涵

我有以下使用从 dockerhub 提取的最新 Ubuntu 映像的 Dockerfile:

 FROM ubuntu:latest
RUN apt-get update  && apt-get install -y  g++ llvm lcov

当我启动 docker build 命令时,会出现以下错误:

Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease 遇到至少一个无效签名。

Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease 遇到至少一个无效签名。

Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease 遇到至少一个无效签名。

Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease 遇到至少一个无效签名。

正在阅读包裹清单…

W:GPG 错误:http: //archive.ubuntu.com/ubuntu bionic InRelease:遇到至少一个无效签名。 E:存储库“ http://archive.ubuntu.com/ubuntu bionic InRelease”未签名。

W:GPG 错误: http ://security.ubuntu.com/ubuntu bionic-security InRelease:遇到至少一个无效签名。 E:存储库“ http://security.ubuntu.com/ubuntu bionic-security InRelease”未签名。

W:GPG 错误:http: //archive.ubuntu.com/ubuntu bionic-updates InRelease:遇到至少一个无效签名。 E:存储库“ http://archive.ubuntu.com/ubuntu bionic-updates InRelease”未签名。

W:GPG 错误:http: //archive.ubuntu.com/ubuntu bionic-backports InRelease:遇到至少一个无效签名。 E:存储库“ http://archive.ubuntu.com/ubuntu bionic-backports InRelease”未签名。

我在这里读到 https://superuser.com/questions/1331936/how-can-i-get-past-a-repository-is-not-signed-message-when-attempting-to-upgr 你可以通过这个错误使用 –allow-unauthenitcated 或 –allow-insecure-repositories 但在我看来,这两种方法都可能会损害容器的安全性。

编辑

试图用不同的发行版名称拉 ubuntu:18.04, ubuntu:19:04, ubuntu:19.10 相同的错误

原文由 Antonio La Marra 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 686
2 个回答

显然我的根分区已满(也许我尝试过多次通过 apt 下载软件包),运行 sudo apt clean 解决了这个问题


此外,以下命令应该有助于清理空间:

 docker system df # which can show disk usage and size of 'Build Cache'
docker image prune # add -f or --force to not prompt for confirmation
docker container prune # add -f or --force to not prompt for confirmation

原文由 Antonio La Marra 发布,翻译遵循 CC BY-SA 4.0 许可协议

自 Docker API v1.25+(发布时间:2019 年 11 月 18 日)起

运行下面的命令为我解决了这个问题:

 docker system prune --force

--force 标志代表非交互式修剪。

此外,您可能想尝试一下 prune volume 命令:

 docker volume prune --force

原文由 Andriy Ivaneyko 发布,翻译遵循 CC BY-SA 4.0 许可协议

推荐问题