DateJul 04, 2021

Installing Docker on Linux Systems (Ubuntu)

This guide is mainly to install Docker CE. Also in case you want to install multiple versions of Docker, better follow the official guide ⬆.

Uninstall the Old Version

Make sure you don't have any other version already installed on the machine.

sudo apt-get remove docker docker-engine docker.io containerd runc

Adding docker Official Repository to APT index

By default, apt does not support Docker to be installed/updated since apt is not aware of the official Docker Repository. In order to add the same.

  1. Update apt package index.
  2. Add Docker’s official GPG key:
  3. Set up a stable repository.

Installing Docker-Engine

  1. Update apt index to latest and install ?Docker Engine
  2. To check the same.

You should now get a response like:

⭐ You might have observed that we used sudo along with docker run to deploy our image to container. This is because no user has been yet added to our Docker group.

Add Current User to Docker Group

Execute the below command to do so:

usermod -a -G docker $USER

⚠ You need to restart the machine (log out & log back in) for the changes to take effect.