我正在尝试在Docker中使用Ubuntu 20.04或Ubuntu 22.04。我的Dockerfile如下:
我用
我会一遍又一遍地收到这条消息,直到我收到:
我尝试在Dockerfile中的第一个运行命令中使用
我还明确运行了
我查阅了所有其他涉及此问题的网络资源,但它们都要求我能够运行
我还尝试了另一个答案中提到的
所以我的镜像没有curl,wget或gnupg,我无法在不解决此问题的情况下安装它。当我使用apt-key执行任何操作时,我会得到以下错误信息:E: gnupg、gnupg2和gnupg1似乎未安装,但其中一个是此操作所需的。
我已经成功手动安装了gnupg的deb文件,并手动接收了密钥,但仍然出现类似的错误消息。
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.
我尝试在Dockerfile中的第一个运行命令中使用
chmod a+rwx /etc/apt -R
,但没有任何效果。我还明确运行了
docker pull ubuntu:22.04
,它显示已经是最新版本。我对ubuntu:20.04
镜像也遇到了完全相同的问题。我查阅了所有其他涉及此问题的网络资源,但它们都要求我能够运行
apt install apt-key
或其他命令,但由于无法更新apt
,所以什么都不起作用。除此之外,搜索引擎的前三页只显示如何在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和gnupg1似乎未安装,但其中一个是此操作所需的。
我已经成功手动安装了gnupg的deb文件,并手动接收了密钥,但仍然出现类似的错误消息。
# 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) <ftpmaster@ubuntu.com>" 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
修剪到最小限度,但问题依然存在。
我该如何从主机中添加所需的密钥?
作为一个次要问题,这样一个主流工具和发行版怎么会出现问题呢?或者是我做了什么明显愚蠢的错误?大家是否已经转向其他工具,如果是,那是什么?由于网络访问不佳,我很难及时了解计算机世界的最新动态。