在 Ubuntu 20.04 LTS(Vmware) 上安装 docker 失败

Men*_*han 17 ubuntu vmware docker ubuntu-20.04

我正在 Ubuntu 20.04 上使用https://docs.docker.com/engine/install/ubuntu/在 VMware 上的 Ubuntu VM 上跟踪 docker 安装。

但是当运行命令将存储库添加到 Ubuntu 时。

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
Run Code Online (Sandbox Code Playgroud)

我得到以下错误

Get:1 http://us.archive.ubuntu.com/ubuntu focal InRelease [265 kB]                                                                           
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                 
Hit:3 http://dl.google.com/linux/chrome/deb stable Release                                                                                   
Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease                                                                             
Ign:6 https://download.docker.com/linux/ubuntu focal InRelease                                             
Err:7 https://download.docker.com/linux/ubuntu focal Release
  404  Not Found [IP: 13.225.7.126 443]
Get:8 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [89.1 kB]
Hit:9 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/ubuntu focal 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.
Run Code Online (Sandbox Code Playgroud)

运行命令时

sudo apt-get install docker-ce docker-ce-cli containerd.io
Run Code Online (Sandbox Code Playgroud)

我得到错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
Run Code Online (Sandbox Code Playgroud)

这是什么原因?我是码头工人的新手。是否有解决方法,或者我应该使用源代码或其他东西安装 docker 吗?谢谢你。

War*_*red 32

目前,您可以使用:

sudo apt-get install -y docker.io
Run Code Online (Sandbox Code Playgroud)

然后检查:

docker -v
Run Code Online (Sandbox Code Playgroud)

  • -y, --yes, --assume-yes :自动提示“是”;假设所有提示的答案都是“是”并以非交互方式运行。 (4认同)
  • 即使在 2022 年,这也有效。官方存储库存在一些证书问题 (4认同)

H A*_*døµ 14

根据在我的 PC 上进行测试后的文档,这些说明将在 WMware Ubuntu focus 上成功安装 docker:

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl  gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


Kun*_*hah 6

Docker 尚未发布 focus fossa (20.04) 的存储库。正如@Wared 所说,运行

sudo apt install -y docker.io

将从 ubuntu 存储库获取 docker。

通过此 docker 安装,我可以在 20.04 上成功使用我在 18.04 中使用的所有 docker 映像。


Jen*_*ens 5

我知道问题是关于Ubuntu 20 的。但是,如果您尝试在Linux Mint 20上安装它(像我一样),问题看起来相同但答案不同。

安装指南告诉您像这样添加 PPA:

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Run Code Online (Sandbox Code Playgroud)

但是,这$(lsb_release -cs)部分是问题所在,因为它将发布名称作为参数传递给存储库命令。在 Ubuntu 20 中,该命令输出focal并且一切顺利,但在 Linux Mint 中,该命令输出ulyana并失败,因为 docker 没有该版本。

如果您想在 mint 上安装它,只需将该命令替换为焦点字符串,即可获得 ubuntu 焦点版本:

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
focal \
stable"
Run Code Online (Sandbox Code Playgroud)