由于公钥不可用,无法验证以下签名:NO_PUBKEY 871920D1991BC93C

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

我正在尝试在 Docker 中使用 Ubuntu 20 或 Ubuntu 22。我的

Dockerfile
是:

from ubuntu:22.04
run DEBIAN_FRONTEND=noninteractive apt update

我用

docker build .
构建这个。结果是:

Sending build context to Docker daemon  2.048kB
Step 1/2 : from ubuntu:22.04
---> 2dc39ba059dc
Step 2/2 : run DEBIAN_FRONTEND=noninteractive apt update
---> Running in b15002ae9dd5

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB] 
Get:2 http://security.ubuntu.com/ubuntu jammy-security 
InRelease [110 kB] 
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB] 
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB] Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease   
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C 

我多次收到此消息,直到收到:

W: http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key.

我尝试将

chmod a+rwx /etc/apt -R
作为
run
中的第一个
Dockerfile
命令,但没有什么区别。

我还明确运行了

docker pull ubuntu:22.04
,它说它已经是最新的了。我对
ubuntu:20.04
图像有完全相同的问题。

我已经咨询了所有其他提到这个问题的网络资源,但它们都要求我能够运行

apt install apt-key
或其他东西,但我无法更新
apt
来开始,所以除了前 3 个之外,没有任何效果搜索引擎点击的页面只是显示如何在 Ubuntu 上安装 Docker,而不是相反。

我也尝试过另一个答案中提到的

--security-opt seccomp:unconfined
。回应为
Error response from daemon: The daemon on this platform does not support setting security options on build

所以我的图像没有

curl
wget
gnupg
,如果不让它工作,我就无法安装它。当我用
apt-key
做任何事情时,我得到:
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

我已成功从 deb 文件手动安装

gnupg
,并手动接收密钥,这给出了类似的错误消息:

# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.rQuYmKpjpo/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C
gpg: requesting key 991BC93C from hkp server keyserver.ubuntu.com
gpg: key 991BC93C: public key "Ubuntu Archive Automatic Signing Key (2018) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA:  1)
W: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '' executing apt-key.

我也尝试过将

/etc/apt/source.list
削减到最低限度。同样的问题。

如何从主机添加所需的密钥?

作为次要问题,如何打破这样的主流工具和发行版?每个人都转向其他事情了吗?它是什么?我没有良好的互联网接入,因此了解计算机世界中发生的最新情况是一个挑战。

docker ubuntu gnupg apt apt-key
2个回答
17
投票

只需升级主机上的docker即可。 https://docs.docker.com/engine/install/ubuntu/

这是保护密钥的新系统调用罕见的不兼容性,旧版 Docker 不支持。没有办法给 Ubuntu 打补丁使其在旧的 Docker 上工作,我花了半天时间尝试。


0
投票

对于较旧的 docker 版本,最新的 ubuntu 版本是 18.04

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