由于公钥不可用,无法验证以下签名 - 多次尝试

由于公钥不可用,无法验证以下签名 - 多次尝试

我的 WSL 上安装了 Ubuntu 20.04,在安装过程中遇到了没有公钥的错误sudo get-apt update。我问了很多问题,到处都是几乎相同的答案,比如:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY>

或者

wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_20.04/Release.key

...但对我而言毫无作用。

完整错误:

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 <KEY>
E: The repository 'https://download.docker.com/linux/ubuntu focal InRelease' is not signed.

有人知道我还能做些什么吗?

答案1

看来您可能尝试在 WSL 下的 Ubuntu 上手动安装 Docker Engine,但错过了一步。您有几种选择:

  • 首先,Docker 和 Microsoft 推荐在 WSL 中安装 Docker 的方法是使用 Docker Desktop for Windows。请参阅这里这就是我同意这一点的原因。

    如果您选择采用这种方式,请从源中删除 Docker 存储库以解决现有错误。您应该能够通过删除 来执行此操作/etc/apt/sources.list.d/docker.list,假设您遵循Docker 文档。否则,在该目录以及文件中查找/etc/apt/sources.list对 Docker 存储库的引用,然后将其删除。

    sudo apt update
    

    此时它就应该成功了。

  • 如果你确实想继续手动安装 Docker Engine,你应该能够通过完成以下步骤中的第 2 步来解决错误:安装说明

    sudo mkdir -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    

    再次,这应该可以解决sudo apt update问题。

相关内容