Ubuntu安装docker报错:E: Package 'containerd.io' has no installation candidate

时间:2022-06-01 12:41:09

Ubuntu版本:19.10

按照docker官网的安装方法,在Ubuntu上按装docker时报错:

Package containerd.io 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 'containerd.io' has no installation candidate

原因是执行命令

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

其中:$(lsb_release -cs)返回的“eoan”即Ubuntu 19.10。猜测可能是Ubuntu 19.10的问题,替换为表示ubuntu 18.10的“bionic”,如下:

$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
bionic \
stable"

为了避免冲突,记得修改“/etc/apt/sources.list”,注释掉

deb-src [arch=amd64] https://download.docker.com/linux/ubuntu eoan stable