38

When I followed the community docks I came across the following issue:

 sudo add-apt-repository \
>    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
>    $(lsb_release -cs) \
>    stable"
[sudo] password for yogesh: 
Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
Get:2 http://in.archive.ubuntu.com/ubuntu focal InRelease [265 kB]             
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease                   
Ign:4 https://download.docker.com/linux/ubuntu focal InRelease                 
Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:6 http://packages.microsoft.com/repos/vscode stable InRelease              
Err:7 https://download.docker.com/linux/ubuntu focal Release                   
  404  Not Found [IP: 54.182.0.11 443]
Hit:8 http://dl.google.com/linux/chrome/deb stable Release                     
Hit:10 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:11 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
  • You could consider installing podman: OSS, no root required, same CLI as docker... – Leder Apr 29 at 10:16
  • 1
    As of now, focal is now avaible in the official repositories. So this question is not valid anymore. download.docker.com/linux/ubuntu/dists/focal – Atif Ali May 16 at 6:47
  • @Leder thanks for the tip about podman: it's a boon to have such a tool in order to avoid giving docker (by default!) root access to my OS – call-in-co Sep 14 at 16:02
49

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.

| improve this answer | |
  • 3
    This is a great answer. Installing things from Ubuntu repos is probably better than adding 3rd party (like Docker) repos to /etc/apt/sources.list. If things are better now, and Ubuntu keeps a modern version of Docker in their own repos, this is what should be, in my opinion, the preferred approach going forward for installing Docker on Ubuntu. – Matt Welke May 1 at 15:15
  • 1
    Thanks for noting the difference between docker.io and docker-ce repo. I've been plagued by 3rd party repos in the past -- I'm installing docker.io :) – Jeff Ward May 3 at 19:33
  • This worked fine on kubuntu local. – Alfabravo May 11 at 19:03
  • 1
    @wedi It's no longer the case. – iBug May 22 at 5:15
  • 1
    Now that the focal release is actually completely available, the correct way to add the repo is: 'add-apt-repository "deb [arch=amd64] download.docker.com/linux/ubuntu focal stable" ' - the official Docker instructions still point to "/debian" -directory which will not work. – DocWeird Jul 7 at 10:53
44

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
| improve this answer | |
  • 3
    I assume it is advisable to update the /etc/apt/sources.list entry from bionic to focal once Docker has been added to the 20.04 repos? – Freek Apr 25 at 14:31
  • Hey thanks, this indeed solved it for me. Any idea when the official Focal repository will be available at the servers of Docker? For some reason I don't like using the bionic repo on my fresh Ubuntu 20.04 server :). What are the downsides of using bionic? – Rogier Lommers Apr 26 at 7:28
  • Thank you. This does resolve the issue with add-apt-repository which seems to be caused due to a missing Release file for Ubuntu 20.04 Focal from Docker. Although @iBug solution seems to be the optimal way to install Docker on Ubuntu 20.04. – R.S Apr 28 at 3:14
  • 1
    Just a note that the repository deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable is located at un Ubuntu 20.04 at /etc/apt/sources.list.d/docker.list. This needs to be removed before attempting to install docker in other ways. – Tk421 May 11 at 2:11
3

You can install it using a single command

sudo apt install docker-compose

| improve this answer | |
  • Yes @karel, you are right, but I found this single command to be more user friendly for beginners. – Atif Ali Apr 27 at 5:47
  • No @karel. It also installs packages 'containerd' and stack of python3 packages, like 'python3-docker'. The docker works on my PC right after that. But it did not work after installing docker.io, or sudo apt-get install docker-ce docker-ce-cli containerd.io from the disco and bionic repositories. – bl79 May 1 at 12:47
  • @bl79 You dont need to install anything more. Just install docker-compose and it will install all its dependencies itself. – Atif Ali May 12 at 9:36
  • that's what I said. – bl79 May 13 at 14:41
  • @bl79 I'm not sure if I'm right with this, but I think the docker-compose version is an Ubuntu package, as the docker package, while docker.io is shipped by the docker team itself. Due to that, docker-compose matchs the docker package version, but is outdated respect to docker.io. That's why, in Ubuntu 20.04, a docker-compose.yml file with version 3.8 is rejected by the docker-compose Ubuntu package; however, docker-compose file format 3.8 is right one respect to the docker.io version. – Peregring-lk Jun 8 at 0:12
0

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
| improve this answer | |
  • 1
    This isn't any different from the first answer. – iBug May 6 at 8:00
  • Right, added more details with screenshots for more clarification. – Raghav May 6 at 9:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.