我正在尝试在我的 Ubuntu 20.04 上安装 docker。尝试使用 和 安装apt-get
docker snap
:
sudo apt-get install docker
输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
wmdocker
The following NEW packages will be installed:
docker wmdocker
0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded.
Need to get 0 B/14.3 kB of archives.
After this operation, 58.4 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package wmdocker.
(Reading database ... 193518 files and directories currently installed.)
Preparing to unpack .../wmdocker_1.5-2_amd64.deb ...
Unpacking wmdocker (1.5-2) ...
Selecting previously unselected package docker.
Preparing to unpack .../archives/docker_1.5-2_all.deb ...
Unpacking docker (1.5-2) ...
Setting up wmdocker (1.5-2) ...
Setting up docker (1.5-2) ...
Processing triggers for man-db (2.9.1-1) ...
如果我运行 docker 命令我会收到错误:
a@ubuntu:~$ docker
Command 'docker' not found, but can be installed with:
sudo snap install docker # version 19.03.11, or
sudo apt install docker.io # version 19.03.8-0ubuntu1.20.04.1
See 'snap info docker' for additional versions.
为什么系统找不到docker命令?
然后我绑了卡扣:
sudo snap install docker
并且 docker 命令运行良好。
为什么我可以用 snap 安装 docker 但不能用 apt-get 安装?
答案1
因为那docker
不是你期望的docker.docker
是 KDE3/GNOME2 系统托盘的软件包名称。您可以通过访问以下网址进行验证:Ubuntu 软件包搜索或者运行
apt show docker
从终端运行时收到的错误消息docker
简要说明了这种混淆。
要安装您期望的docker,请参考官方文档或查看如何在 Ubuntu 20.04 LTS 上安装 docker 社区?