【学习笔记】解决Ubuntu20.04安装Docker时,设置仓库失败问题

使用Ubuntu首次安装Docker时,需要使用以下指令设置Docker的稳定版仓库,以便之后可以通过仓库安装和更新Docker
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

但是在设置过程中遇到了以下错误:

Err:5 https://download.docker.com/linux/ubuntu focal Release                          
  404  Not Found [IP: 13.249.173.43 443]

原以为是仓库问题,换了几个国内IP同样报错,继续安装Docker则会出现以下错误:

Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io

最后通过以下方式成功解决:

  1. 通过命令vim /etc/apt/sources.list打开sources.list文件
  2. 翻到最下面,不出意外应该可以看到红框标注的内容,这个就是之前通过指令设置的Docker仓库地址
    【学习笔记】解决Ubuntu20.04安装Docker时,设置仓库失败问题_第1张图片
  3. 将红框标注的内容替换为以下内容,保存即可
    deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
    

你可能感兴趣的:(【学习笔记】解决Ubuntu20.04安装Docker时,设置仓库失败问题)