How to install docker community on Ubuntu 20.04 LTS?

Solution 1:

Update: As of 3 AM on May 15, the official Docker repository is available for Ubuntu Focal, so you can follow the installation guide on your Ubuntu to get Docker up and running.


Another option is to install Ubuntu-provided version of Docker:

sudo apt install docker.io

Long ago there were significant backlashes against this because the package docker.io from upstream (Debian) was too old - this is no longer the case. For Focal, docker.io is currently (Apr 24, 2020) at 19.03.8-0ubuntu1, which is satisfactorily new for the majority of Docker workloads.


Don't install docker by mistake - it used to be the system tray application, which has since been replaced by gnome-shell-extension-ubuntu-dock. The docker package can be safely removed had you installed it accidentally.

Solution 2:

Release file is available now. Follow the docker community guidelines.


As of today 28, April the release file for Ubuntu 20.04 LTS focal is not available.

So in order to install docker on Ubuntu 20.04 LTS focal release as guided on docker community link

you can change the following command :

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

to

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   bionic \
   stable"

By that what we are doing is we are using bionic (Ubuntu 18.04 LTS) release file.

Rest of the commands are okay and will work on 20.04 as well.

Also make sure that you removed the following entry from your /etc/apt/sources.list if present before installing docker

deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable

Solution 3:

You can install it using a single command

sudo apt install docker-compose

Solution 4:

Following steps can help you:

Run the following commands:

sudo apt-get update

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Open /etc/apt/sources.list file by running

sudo nano /etc/apt/sources.list

Comment out the following line:

#deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable

Press Ctrl+o to save, ctrl+x to close.

enter image description here Run the following command to install docker:

sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io

Running the above command will successfully install docker:

enter image description here

You can verify the docker version to confirm if it has been installed successfully:

docker -v

enter image description here

EDIT:

If you are on AWS EC2 just run the following command and it will install the Docker there:

sudo apt install docker.io 
sudo systemctl enable --now docker