apt-get update出现NO_PUBKEY错误的解决方法

安装docker-ce,执行https://mirror.tuna.tsinghua.edu.cn/help/docker-ce/

添加docker-ce库以后,执行sudo apt update,报如下错误:

W: GPG error: https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8

运行如下命令,添加公钥解决:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7EA0A9C3F273FCD8

命令执行结果:

Executing: /tmp/apt-key-gpghome.WdAbHsAr79/gpg.1.sh --recv-keys --keyserver keyserver.ubuntu.com 7EA0A9C3F273FCD8
gpg: key 8D81803C0EBFCD88: 5 signatures not checked due to missing keys
gpg: key 8D81803C0EBFCD88: public key "Docker Release (CE deb) " imported
gpg: Total number processed: 1
gpg:               imported: 1

重新执行 sudo apt update,可以正常更新

你可能感兴趣的:(Linux)