Docker installation - Ubuntu 20.04 LTS

Install on Ubuntu (easy way)

# install
sudo apt install -y docker-compose

# use Docker as a non-root user
# get rid of having to sudo or be root
sudo usermod -aG docker $(whoami)

# logout and login again for the group change to work

You don't need to install the long manual way, is already provided as a package in the Ubuntu repos and the version is fairly up to date (19.03.8-0ubuntu1 as of this writing, which is the latest version). You can check which version comes with the commandapt info


note that in Ubuntu docker is a tray plugin, while is the Docker containerization software. the name docker wasn't available so they went with

Install on Ubuntu (hard way)

Since i had already written this, i'm keeping the content. But the one-liner command above is good enough

# uninstall any existing docker
sudo apt-get remove docker docker-engine containerd runc

# enable https repos
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common

# Add Docker’s official GPG key
curl -fsSL | sudo apt-key add -

# add repo
sudo add-apt-repository "deb [arch=amd64] bionic stable"

# install Docker
sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli

Since the release for 20.04 LTS is not available as of this writing, i'm adding the bionic repo instead ref. bionic instead of $(lsb_release -cs)

User permissions

If you keep getting permission denied errors like these

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

This means you need to run the command with sudo. You can get rid of having to sudo by adding yourself to the docker user group

sudo usermod -aG docker $(whoami)

Make sure you logout and log back in after this in order for the change to work


Please note that this site and the posts on it are, and will always be, a work in progress. If i waited for perfection, i’d never get anything done.