Categories: LinuxUbuntu

Install Docker on Ubuntu 20.04 or 20.10

Make sure your Ubuntu is up to date and patched.

$ sudo apt update
$ sudo apt upgrade

Docker is available within Ubuntu’s default software repositories but installation package available in the official Ubuntu repository may not be the latest version. To ensure we get the latest version, we’ll install Docker from the official Docker repository. To do that, we’ll add a new package source, add the GPG key from Docker to ensure the downloads are valid, and then install the package.

# First, uninstall old versions of Docker such as docker, docker.io or docker-engine
$ sudo apt-get remove docker docker-engine docker.io containerd runc

# Install a few prerequisite package 
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

# Add GPG key for the official Docker repository
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Add the Docker repo to APT sources
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Update the package database
$ sudo apt update

Finally install the Docker Community Edition’s latest version

$ sudo apt install docker-ce -y

$ sudo systemctl status docker

The Docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo. The Docker daemon always runs as the root user.

If you don’t want to preface the docker command with sudo, create a Unix group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group.

# Create the docker group if not exsists
$ sudo groupadd docker

# Add your user to the docker group.
$ sudo usermod -aG docker $(whoami)

# Apply the new group membership by logging out
$ su - $(whoami)

# Confirm user group
$ id -nG

Have fun!

Emre KARABULUT

Hi, I’m Emre KARABULUT, 29, and I am the owner of a small (but perfectly formed) design studio called Minimalist Art & Design based in Istanbul, which specialises in Blog and User Interface design. I help entrepreneurs and small business owners create a unique brand and online presence which gives them a powerful platform to reach out to their customers and markets.

Recent Posts

Authenticating with the Apple Search Ads API

There are many methods for using APIs. In order to understand it better, lets take…

4 years ago

How To Add Swap Space on Ubuntu 20.04 or 20.10

One way to guard against out-of-memory errors in applications is to add some swap space.…

4 years ago

Install Docker-Compose on Ubuntu 20.04 or 20.10

Docker Compose is a tool that allows you to run multi-container application environments based on…

4 years ago

Shopware 6 – Local installation in Ubuntu 20.04 or 20.10

After the creation of development environment your setup fulfills the Shopware 6 requirements. If you…

4 years ago

Shopware 6 – Docker installation in Ubuntu 20.04 or 20.10

After the creation of development environment your setup fulfills the Shopware 6 requirements. If you…

4 years ago

Shopware 6 – Installing System Requirements in Ubuntu 20.04 or 20.10

To create a development environment in fresh install of Linux - Ubuntu 20.04 (Focal Fossa)…

4 years ago