[英]GPG error in Ubuntu 21.04 after second apt-get update during Docker build
构建以下 Docker 文件时出错
FROM ubuntu:21.04
RUN apt-get update && \
apt-get install --no-install-recommends -y curl=7.\* && \
apt-get install --no-install-recommends -y unzip=6.\* &&\
rm -rf /var/lib/apt/lists/*
RUN apt-get update && \
mkdir -p /usr/share/man/man1 && \
apt-get install --no-install-recommends -y maven=3.6.3-5 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
当第二个apt-get update
运行时发生错误。
错误如下:-
E: The repository 'http://security.ubuntu.com/ubuntu hirsute-security InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu hirsute InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu hirsute-updates InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-updates InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu hirsute-backports InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-backports InRelease' is not signed.
任何形式的帮助将不胜感激。
这是 docker / seccomp / glibc 交互中的一个错误: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1916485
我已经运行了您的 docker 文件并得到了同样的错误。 尝试各种禁用验证的方法也没有产生好的结果。 也没有删除版本限制,只安装了最新版本的工具。 我能找到的唯一解决方案是将 ubuntu 降级到 20.04,但是对于该版本的操作系统,没有 3.6.3-5 版本的 maven,只有 3.6.3-1(afaik)。
我能得到的最接近的工作与您想要的图像完全不同:
FROM ubuntu:20.04
RUN apt update && \
apt install --no-install-recommends -y curl=7.\* unzip=6.\* maven=3.6.3-1 && \
apt clean && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /usr/share/man/man1
还要注意我如何使用apt
而不是apt-get
并且我只运行一次(通过只有一个层来制作更简单的图像)并且只有一个apt update
并将我想要安装的东西链接到一个apt install
而不是分开的。 这只是更快更容易。
但是,如果您想要一个 maven 构建盒,也许您最好使用来自 docker 集线器的预构建 maven 图像之一,这些图像本身基于 openjd 图像。 对于 java 来说,底层的 linux 发行版很少重要,并且 openjdk 映像非常受尊重:
from maven:3.6.3-jdk-11
run apt update && apt install -y curl unzip && apt clean
如果使用较新版本的 Docker(使用 20.10 测试),则不会出现此错误。 如果使用旧版本的 Docker,我建议切换到以前版本的 ubuntu 映像。 我用 Docker 19.03 测试了 ubuntu:20.10,它工作得很好。 这在这里讨论: https://bugs.launchpad.net/cloud-images/+bug/1928218
当我在 Rootless Docker 下运行 Ubuntu 21.04 映像时遇到了这个问题,但是apt-get update
命令在系统 ZC5FD214CDD0D2B3B4272E73B02s 下运行良好(通过sudo
BA 调用) 由于我只需要手动测试环境设置脚本,因此我只是在系统 Docker 下运行,但根据您的应用程序,这可能不安全。
用apt
代替apt-get
对我有用。
更新Docker版本到最新版本解决了这个问题。
对于 ubuntu 用户,请按照以下步骤操作:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
其他请参考此链接: https://docs.docker.com/engine/install/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.