Can't install docker on Ubuntu 20.04

I haven’t upgraded to 20 yet, but this happened to me with several packages in early days of earlier releases. They just haven’t officially released a focal version yet.

This is untested but you can try using their package for ubuntu 19.10 by manually changing your apt sources, its always worked for me before with docker and others, he repo gpg keys should be the same.

Open apt sources list in a text editor, like nano:
sudo nano /etc/apt/sources.list

(It might be in /etc/apt/sources.list.d/docker.list or something, depending how it was installed)

Scroll to the bottom and look for the lines:
deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu focal stable

Comment out that first line with a # at the beginning, then copy the same line right below it, except switching out the ubuntu codename focal for eoan.
It should end up looking like:
# deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
deb [arch=amd64] https://download.docker.com/linux/ubuntu eoan stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu focal stable

Ctrl+o to save, y to confirm filename, ctrl+x to close.

Then refresh your apt packages and try installing docker again :
sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io

Like i said, i havent tested this yet for focal, but its always worked for me before.

When a 20.04 package is released, just go back in to that same file and remove the # from the line with focal, and comment out or just delete the line with eoan, then sudo apt update && sudo apt full-upgrade

5 Likes