To ensure that we install Docker from the official Docker repository and not from the Ubuntu repository issue the following commands:

sudo apt-get install -y software-properties-common apt-transport-https ca-certificates

sudo apt-key adv --keyserver hkp:// --recv-keys 9DC858229FC7DD38854AE2D88D81803C0EBFCD88

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Update the packages:

sudo apt-get update

Issue the following command to install Docker

sudo apt-get install docker-ce -y

If you would like the current user to run docker commands without using sudo, then issue the following command:

sudo usermod -aG docker $USER