4

I'm trying to install docker on my Ubuntu 20.04. Trying install docker with apt-get and snap:

sudo apt-get install docker

Output:

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) ...

If I run docker command I get error:

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.

Why system can't find docker command?

Then I tied snap:

sudo snap install docker 

And docker command run fine.

Why I can install docker with snap and can't with apt-get ?

vico
  • 4,527
  • 21
  • 58
  • 87

1 Answers1

7

Because that docker is not the docker you expected. docker is the package name of system tray for KDE3/GNOME2. You can verify that by visiting Ubuntu package search or by running

apt show docker

The error message you got while running docker from terminal gives a brief idea about this confusion.

To install the docker you expected, refer to official documentation or see How to install docker community on Ubuntu 20.04 LTS?

Kulfy
  • 17,696
  • 4
    docker.io is Docker package in APT! – N0rbert Dec 05 '20 at 07:02
  • @N0rbert Though Ubuntu's official repository contains docker as docker.io, docker's official documentation states, "Older versions of Docker were called docker, docker.io, or docker-engine". And the very first step is to remove them. ¯\(ツ)/¯ Anyway with Docker's repository you can have latest version in Xenial Xerus which is not the case with docker.io. – Kulfy Dec 05 '20 at 07:28
  • Agree that docker name confuses the user. But docker.io is working normally when installed :) – N0rbert Dec 05 '20 at 07:41
  • If it is not the real docker how it can pull images, and run them? I just installed the docker via snap sudo snap install docker and it can run hello-world docker run hello-world – AVarf Apr 07 '22 at 09:38
  • @AVarf I believe you misread the question as well as answer. In the question as well, vico confirmed that snap version was working fine which I never denied. My answer was related to the docker installed using APT. – Kulfy Apr 07 '22 at 09:40
  • I am sure I read the Q correctly since I have the same problem and because of some firewall I can't install docker via apt but I am able to install it via snap. Maybe I misunderstood your answer. The only thing I want to know is what are the differences between docker installed via apt and snap? One I could find is when installed via snap there is no docker.service (Unit docker.service could not be found.) – AVarf Apr 07 '22 at 09:48
  • 1
    @AVarf APT installs deb packages. Snaps and debs differ functionally. See https://snapcraft.io/blog/a-technical-comparison-between-snaps-and-debs. For service not found issue, on a quick Google search, I found this https://askubuntu.com/q/977961 – Kulfy Apr 07 '22 at 09:57