docker Got permission denied while trying to connect to the Docker daemon socket Post dial unix var run docker sock connect permission denied

+2 votes

Hi Guys,

I am trying to run one docker container from jenkins shell, but it is showing me the below error.

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.37/containers/create?name=web: dial unix /var/run/docker.sock: connect: permission denied.

How can I solve this?

May 5, 2020 in Jenkins by akhtar
• 38,260 points
14,684 views

I got a similar error. Please make sure you create a usergroup for Docker, add Jenkins user to the group you created and give permission to the Jenkins user for Docker

sudo useradd user-name

sudo passwd user-name 

sudo groupadd docker

Sudo usermod -aG docker user-name

Sudo chmod 777 /var/run/docker.sock

1 answer to this question.

+1 vote
Best answer

Hi@akhtar,

Here you have to give root power to your jenkins user. Otherwise your jenkins user will not able to run any job in your system.

If you are using Linux system, then open /etc/sudoers file and write down the bellow given line.

jenkins ALL=(ALL) NOPASSWD: ALL

Hope this will help.

answered May 5, 2020 by MD
• 95,460 points

selected Dec 24, 2020 by akhtar

Related Questions In Jenkins

0 votes
1 answer
+2 votes
3 answers

Permission denied error while running a simple job in Jenkins

Hey @Hannah, try changing the permissions using ...READ MORE

answered Oct 25, 2018 in Jenkins by krishti
58,551 views
0 votes
1 answer

I’m facing a login error when I try to run Jenkins on Docker. How do I solve this?

You have to open the /var/log/jenkins/jenkins.log file to ...READ MORE

answered Jul 24, 2018 in Jenkins by Sophie may
• 10,620 points
3,590 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,731 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP