Docker 安装问题 (ubuntu 20.04 LTS) - E: 存储库 'https://download.docker.com/linux/ubuntu \ Release' 没有发布文件

Docker installation problem (ubuntu 20.04 LTS) - E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file

我在虚拟机上安装 docker 时遇到问题。 我已按照以下步骤操作:

1. Docker 的旧版本称为 docker、docker.io 或 docker-engine。如果安装了这些,请卸载 他们:

sudo apt-get remove docker docker-engine docker.io containerd runc

2。更新 apt 包索引

sudo apt-get update

3。安装软件包以允许 apt 通过 HTTPS 使用存储库:

   sudo apt-get install \
   apt-transport-https \
   ca-certificates \
   curl \
   gnupg \
   lsb-release

4.添加Docker的官方GPG密钥:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

5.使用以下命令设置稳定存储库:

   echo \
     "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
   https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >
   /dev/null

6.更新 apt 包索引

sudo apt-get update

此时 - 输入 sudo apt-get update 后 - 我收到以下错误

root@xxx:/home/xxx# sudo apt-get update
Hit:1 http://us-central1.gce.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us-central1.gce.archive.ubuntu.com/ubuntu focal-updates InRelease                                    
Hit:3 http://us-central1.gce.archive.ubuntu.com/ubuntu focal-backports InRelease                                  
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease                                                  
Ign:5 https://download.docker.com/linux/ubuntu \ InRelease                                              
Err:6 https://download.docker.com/linux/ubuntu \ Release
  404  Not Found [IP: 13.249.137.69 443]
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file.
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.

/etc/apt/sources.list.d/docker.list

的内容

deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] download.docker.com/linux/ubuntu \ focal stable

有办法解决吗?

确保 /etc/apt/sources.list.d/docker.list 的内容对应于 documentation 中命令的输出,项目符号 #3。

在撰写本文时,在我的 Ubuntu 20.04 LTS 上执行命令会导致 docker.list 文件的以下内容:

deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable

这好像和你的不一样