1. 执行 sudo apt-get update 命令时遇到这个错误,是服务器没有这个公钥的意思
root@admin:~# sudo apt-get update
Get:1 https://download.docker.com/linux/ubuntu focal InRelease [36.2 kB]
Err:1 https://download.docker.com/linux/ubuntu focal InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Reading package lists... Done
W: GPG error: https://download.docker.com/linux/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/ubuntu focal 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. 解决问题,将这个公钥添加到服务器
将这个公钥添加到服务器即可
root@admin:~# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8
Executing: /tmp/apt-key-gpghome.ho1hJFCkqg/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8
gpg: key 8D81803C0EBFCD88: public key "Docker Release (CE deb) <docker@docker.com>" imported
gpg: Total number processed: 1
gpg: imported: 1
如下图提示,就是成功了,重新执行sudo apt-get update