Home How to Install Docker and Docker Compose
Post
Cancel

How to Install Docker and Docker Compose

Install Docker

If you have an existing version of Docker install, it might be best to remove it first. See the cleaning up section at the end

1
2
3
4
5
6
7
sudo apt-get update
sudo apt-get install \
  apt-transport-https \
  ca-certificates \
  curl \
  gnupg \
  lsb-release
1
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
1
2
3
 echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
1
2
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Check Install

1
docker -v

Install Docker Compose

1
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
1
sudo chmod +x /usr/local/bin/docker-compose

Check Install

1
docker-compose -v

Use Docker without sudo

1
sudo usermod -aG docker $USER

You’ll need to log out then back in to apply this

Cleaning Up

If you need to uninstall Docker, run the following

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

Information from technotim.live

This post is licensed under CC BY 4.0 by the author.