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

+1 vote

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 in Jenkins by akhtar
• 25,030 points
2,836 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.

0 votes

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 by MD
• 56,480 points

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
21,273 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,100 points
932 views
+1 vote
4 answers

Is there a way to change the Jenkins build number while building a job?

If you have access to the script ...READ MORE

answered May 7, 2019 in Jenkins by Atul
10,832 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
• 57,640 points
777 views