Docker Installation

Roshan PoudelRoshan Poudel
1 min read

Every one will say you what docker is. That's why let's directly jump into picture.

Docker Installation

Installation on Linux

First, update your package list and install necessary prerequisites:

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

Add Docker's official GPG key to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add Docker's repository to your APT sources:

echo "deb [arch=amd64 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

Update your package list to include the Docker packages:

sudo apt update

Now install Docker:

sudo apt install docker-ce docker-ce-cli containerd.io

Start Docker and enable it to start on boot:

sudo systemctl start docker
sudo systemctl enable docker

Verify that Docker is installed correctly by running a test container:

sudo docker info
sudo docker run hello-world

If you want to run Docker commands without sudo, add your user to the docker group:

sudo usermod -aG docker $USER

Log out and log back in so that your group membership is re-evaluated.

If you encounter any issues, check the status of the Docker service and review logs:

sudo systemctl status docker
sudo journalctl -u docker
1
Subscribe to my newsletter

Read articles from Roshan Poudel directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Roshan Poudel
Roshan Poudel

DevOps / Cloud Engineer