Docker Community Forums

Share and learn in the Docker community.

Not able to install docker in Ubuntu 20.04

Hello, just followed the simple guide here : https://docs.docker.com/engine/install/ubuntu/

And in the end when i do : sudo docker run hello-world

I see : sudo: docker: command not found

Help please. Thanks

Are you sure you installed docker-ce-cli too?

Installing Docker
Note: All the commands in this tutorial should be run as a non-root user. If root access is required for the command, it will be preceded by sudo.
The Docker installation package available in the official Ubuntu 20.04 repository may not be the latest version. To get the latest and greatest version, install Docker from the official Docker repository. This section shows you how to do just that.
First, add the GPG key for the official Docker repository to the system:

Add the Docker repository to APT sources:
As Docker is not available even for test source (at this time) we will use eoan sourcelist and will get release from eoan.

Note: If you get an E: Package ‘docker-ce’ has no installation candidateerror when using only stable APT source this is because the stable version of docker for Ubuntu 20.04 doesn’t exist yet.
Meanwhile you have to use the edge / test version.
Stable releases are done quarterly, so .03, .06, .09 and .12 are stable releases.
Starting with Docker 17.06, stable releases are also pushed to the edge and test repositories.
Next, update the package database with the Docker packages from the newly added repo:
sudo apt-get update
Make sure you are about to install from the Docker repo instead of the default Ubuntu 20.04 repo:
apt-cache policy docker-ce
You should see output similar to the follow:

Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 19.10. The docker-ce version number might be different.
Finally, install Docker:
sudo apt-get install -y docker-ce
Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:
sudo systemctl status docker
The output should be similar to the following, showing that the service is active and running:

Installing Docker now gives you not just the Docker service (daemon) but also the docker command line utility, or the Docker client.