Installing the latest version of Docker on Linux

As usual, most repositories have a version of Docker which is several releases old.  Let’s install the latest version directly from Docker.


Ubuntu/Mint

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Be sure that you are using your release of Ubuntu.  In this example I'm using Focal.
# To get your release codename, run: lsb_release -a
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

sudo apt-get update
sudo apt-get install docker-ce

If you want your user to be able to utilize Docker without elevating rights, add them to the Docker group in /etc/group:

sudo vim /etc/group

Add your user to the Docker group:

...
docker:x:999:your-user-name
...

CentOS/RedHat/Fedora

sudo yum update
curl -fsSL https://get.docker.com/ | sh
sudo systemctl enable docker --now

If you want your user to be able to utilize Docker without elevating rights, add them to the Docker group in /etc/group:

sudo vim /etc/group

Add your user to the Docker group.  In CentOS/RedHat/Fedora this may already be present:

...
docker:x:999:your-user-name
...