# 下载镜像~]# docker pull ubuntu:22.0422.04: Pulling from library/ubuntu79d0ea7dc1a8: Pull complete Digest: sha256:dfd64a3b4296d8c9b62aa3309984f8620b98d87e47492599ee20739e8eb54fbfStatus: Downloaded newer image for ubuntu:22.04docker.io/library/ubuntu:22.04# 进入容器docker run -it ubuntu:22.04 bash# 更新包root@e0ab4ec26d51:/# apt updateGet:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease [270 kB]Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB]Err:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CGet:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [108 kB]Err:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CGet:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]Err:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CErr:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CReading package lists... DoneW: http://ports.ubuntu.com/ubuntu-ports/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.W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://ports.ubuntu.com/ubuntu-ports jammy InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/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.W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-backports/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.W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-backports/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-security/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.W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-security/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.
2. 尝试方法
# 1.添加key文件root@e0ab4ec26d51:/# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93CE: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation# 失败,缺少命令# 2.尝试使用gpg添加key文件# gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32# gpg --export --armor 3B4FE6ACC0B21F32 |apt-key add -root@e0ab4ec26d51:/# gpg --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93Cbash: gpg: command not foundroot@e0ab4ec26d51:/# gpg --keyserver keyserver.ubuntu.com --recv 467B942D3A79BD29^Croot@e0ab4ec26d51:/# apt install gpgReading package lists... DoneBuilding dependency tree... DoneReading state information... DoneE: Unable to locate package gpg# 失败,缺少命令# 尝试更换apt镜像源root@e0ab4ec26d51:/# echo "deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse" > /etc/apt/sources.listroot@e0ab4ec26d51:/# apt updateGet:1 http://mirrors.aliyun.com/ubuntu jammy InRelease [270 kB]Get:2 http://mirrors.aliyun.com/ubuntu jammy-security InRelease [110 kB]Get:3 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease [119 kB]Err:1 http://mirrors.aliyun.com/ubuntu jammy InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CGet:4 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease [108 kB]Err:2 http://mirrors.aliyun.com/ubuntu jammy-security InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CErr:3 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CErr:4 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CReading package lists... DoneW: http://mirrors.aliyun.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.W: http://mirrors.aliyun.com/ubuntu/dists/jammy/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://mirrors.aliyun.com/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://mirrors.aliyun.com/ubuntu jammy InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.W: http://mirrors.aliyun.com/ubuntu/dists/jammy-security/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.W: http://mirrors.aliyun.com/ubuntu/dists/jammy-security/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://mirrors.aliyun.com/ubuntu jammy-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://mirrors.aliyun.com/ubuntu jammy-security InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.W: http://mirrors.aliyun.com/ubuntu/dists/jammy-updates/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.W: http://mirrors.aliyun.com/ubuntu/dists/jammy-updates/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://mirrors.aliyun.com/ubuntu jammy-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://mirrors.aliyun.com/ubuntu jammy-updates InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.W: http://mirrors.aliyun.com/ubuntu/dists/jammy-backports/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.W: http://mirrors.aliyun.com/ubuntu/dists/jammy-backports/InRelease: 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 '_apt' executing apt-key.W: GPG error: http://mirrors.aliyun.com/ubuntu jammy-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93CE: The repository 'http://mirrors.aliyun.com/ubuntu jammy-backports InRelease' is not signed.N: Updating from such a repository can't be done securely, and is therefore disabled by default.N: See apt-secure(8) manpage for repository creation and user configuration details.# 失败,还是不行