Cover image for Install docker on Linux

Install docker on Linux

devdpk profile image Deepak Sabhrawal Updated on ・1 min read

Run the following command to install docker on Linux.


$sudo apt install docker.io

Arch Linux

$sudo pacman -S docker


$sudo dnf install docker


$sudo yum install docker

Check if the docker is running with the following command
$sudo docker ps

But, if you will run it without sudo you will get the following error:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied

This happens due to the permission issue as the current user is not having permission to run docker.

Run the below command to add the current user to docker group
$sudo usermod -a -G docker $USER

You must logout and login or restart to let the system run group policy again and add the current user to the docker group
Run below command after re-login

$docker ps -a (to see all processes - running/exited)

To check successful installation of the docker
$docker run hello-world


Hello from Docker!
This message shows that your installation appears to be working correctly.

Congratulations! you successfully installed docker on your system

Happy dockering! & keep learning!

Posted on by:


markdown guide