Debian

在 debian 上安裝 docker 時出現 gpg 錯誤

  • May 13, 2020

我按照這些說明docker在 debian 9.11 “stretch”上安裝

https://docs.docker.com/engine/install/debian/

我的文件/etc/apt/sources.list看起來像這樣

deb http://repo.myloc.de/debian stretch main non-free contrib
deb-src http://repo.myloc.de/debian stretch main non-free contrib

deb http://repo.myloc.de/debian-security stretch/updates main
deb-src http://repo.myloc.de/debian-security stretch/updates main

deb http://repo.myloc.de/debian stretch-updates main
deb-src http://repo.myloc.de/debian stretch-updates main

deb https://download.docker.com/linux/debian stretch stable
#deb-src [arch=amd64] https://download.docker.com/linux/debian stretch stable

命令

curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

OK

apt update導致

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://get.docker.com/ubuntu docker Release: The following signatures were invalid: 36A1D7869245C8950F966E92D8576A8BA88D21E9
W: Failed to fetch https://get.docker.com/ubuntu/dists/docker/Release.gpg  The following signatures were invalid: 36A1D7869245C8950F966E92D8576A8BA88D21E9
W: Some index files failed to download. They have been ignored, or old ones used instead.

我對ubuntu那裡的提及感到困惑,但可能沒關係。

編輯:評論中要求的其他資訊

> uname -a
Linux b028 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64 GNU/Linux

> grep ^deb /etc/apt/sources.list.d/*
/etc/apt/sources.list.d/docker.list:deb https://get.docker.com/ubuntu docker main
/etc/apt/sources.list.d/docker.list.save:deb https://get.docker.com/ubuntu docker main
/etc/apt/sources.list.d/nodesource.list:deb https://deb.nodesource.com/node_0.12 wheezy main
/etc/apt/sources.list.d/nodesource.list:deb-src https://deb.nodesource.com/node_0.12 wheezy main
/etc/apt/sources.list.d/nodesource.list.save:deb https://deb.nodesource.com/node_0.12 wheezy main
/etc/apt/sources.list.d/nodesource.list.save:deb-src https://deb.nodesource.com/node_0.12 wheezy main

目錄的內容sources.list.d可能是錯誤的殘餘。可能,我必須刪除它們。

是的,您需要刪除下面的 docker 儲存庫/etc/apt/sources.list.d/(它不是有效的 docker 儲存庫,它是 docker 安裝腳本的 url):

sudo rm /etc/apt/sources.list.d/docker.list{,.save}

然後編輯你的sources.list

sudo apt edit-sources

更改以下行:

deb https://download.docker.com/linux/debian stretch stable

deb [arch=amd64] https://download.docker.com/linux/debian stretch stable

然後執行:

sudo apt update
sudo apt install docker-ce

引用自:https://unix.stackexchange.com/questions/586258