Ubuntu 上安装 Docker 遇到 '无法找到软件包' 错误的解决方法
在 Ubuntu 系统上使用 apt install docker-ce docker-ce-cli containerd.io 命令安装 Docker 时,您可能会遇到以下错误:
apt install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree... Done
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
Package 'docker-ce-cli' 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
However the following packages replace it:
docker-buildx-plugin
E: Package 'docker-ce' has no installation candidate
E: Package 'docker-ce-cli' has no installation candidate
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
这个错误表示无法找到 docker-ce、docker-ce-cli 和 containerd.io 软件包。这可能是因为您的软件源中没有这些软件包的信息。
要解决这个问题,您可以尝试以下步骤:
-
确保您的软件源已更新。 运行以下命令来更新软件源:
sudo apt update -
确保您已添加 Docker 的官方软件源。 运行以下命令来添加软件源:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable' -
再次运行安装命令:
sudo apt install docker-ce docker-ce-cli containerd.io
如果问题仍然存在,请确保您的操作系统版本与 Docker 的软件源兼容,并查看 Docker 官方文档以获取更多帮助。
原文地址: https://www.cveoy.top/t/topic/fwab 著作权归作者所有。请勿转载和采集!