Install Docker and Docker-Compose on Ubuntu 20.04


Install necessary tools:

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

Add Docker key:

curl -fsSL | sudo apt-key add -

Add Docker repo (choose the correct repository):

32bit / 64bit OS

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

ARM 32bit

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

ARM 64bit

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

Switch to correct repo:

apt-cache policy docker-ce

Install Docker:

sudo apt install docker-ce -y

If you are not root, run this to allow using Docker without sudo in the future:

sudo usermod -aG docker ${USER}

Log-out and log-in to use updated user-group setting.

Install Docker-Compose

sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Set permission:

sudo chmod +x /usr/local/bin/docker-compose

Done. Easy!