Docker installation

Share this post on:


sudo apt update
sudo apt install \
ca-certificates \
curl \
gnupg \

Add official Docker’s GPG key

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install Docker engine

sudo apt update --allow-insecure-repositories
sudo apt --allow-unauthenticated install docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin
Receiving a GPG error when running ‘apt update‘?

Your default umask may not be set correctly, causing the public key file for the repo to not be detected. Run the following command and then try to update your repo again: ‘sudo chmod a+r /etc/apt/keyrings/docker.gpg‘.

Run ‘docker‘ without ‘sudo‘

sudo groupadd docker
sudo usermod -a -G docker $USER
grep docker /etc/group
newgrp docker

Validate installation

sudo docker run hello-world
Share this post on:

Author: tayyebi

Tayyebi works in the role of Director at Gordarg where he is the founder. He is passionate about people, technology, and arts. Mohammad believes in communications, each of us has the power to empower their people with knowledge. He can be seen writing codes, playing music, biking, and reading.

View all posts by tayyebi >