docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.35/containers/create: dial unix /var/run/docker.sock: connect: permission denied. See ‘docker run –help’.
To fix this issue, we have to create a group, assign the user to the group and then give the permissions to /var/run/docker.sock
Add docker group
Table of Contents
$ sudo groupadd docker
Add your current user to the docker group
$ sudo usermod -aG docker $USER
Switch session to the docker group
$ newgrp - docker
Run an example to test
$ docker run hello-world
Still, if you are facing the permission denied error, then give the permission to /var/run/docker.sock like as follows.
Give Permissions
sudo chmod 666 /var/run/docker.sock
And then try again docker run hello-world
Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in the IT industry for more than 12 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting, Website Development, and IAM(ForgeRock) Specialist
I am a self-learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.