参照官网https://docs.docker.com/desktop/setup/install/linux/ubuntu/ 在Ubuntu上安装docker-desktop-amd64.deb,最后在执行sudo apt-get install ./docker-desktop-amd64.deb的时候,却出现了以下错误:

sudo apt-get install ./docker-desktop-amd64.deb

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'docker-desktop' instead of './docker-desktop-amd64.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 docker-desktop : Depends: docker-ce-cli but it is not installable
E: Unable to correct problems, you have held broken packages.

经过一些列的排查,参考大佬神作https://blog.csdn.net/heyl163_/article/details/131503469,最终顺利解决。现将终极安装docker-desktop-amd64.deb方法总结如下:

1、更新软件源

sudo apt update

 2、安装基本软件

sudo apt-get install apt-transport-https ca-certificates curl software-properties-common lrzsz -y

3、指定使用阿里云镜像 

添加密钥

# 新方法
sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# 旧方法
sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

根据ubuntu版本不同,在ubuntu24.04中使用上述旧方法可能会输出以下内容,自己玩玩Docker的话,可以不用管它。

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

添加阿里云镜像

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

4、更新软件源

sudo apt update

5、安装docker-desktop-amd64.deb

sudo apt-get install ./docker-desktop-amd64.deb

安装过程中,可能会出现一些警告信息。经过实测,使用中没有发现问题。如果有洁癖,那就继续参照网上大佬的方法解决。

Logo

码道开发者社区,聚焦华为云码道 CodeArts 代码智能体,沉淀 Agent、Skill、鸿蒙开发实战内容,供开发者查阅资料、交流技术、分享工程实践

更多推荐