I'm trying to run docker with Jenkins pipeline but I'm facing this Jenkins pipeline error and a socket.io error.

0 votes

I’m trying to execute a docker image within a Jenkins pipeline but I always come across this error. Any help?

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.26/containers/hello-world/json: dial unix /var/run/docker.sock: connect: permission denied.

Jun 26, 2018 in Docker by Zulaikha
• 840 points
4,988 views

3 answers to this question.

0 votes

This happens when the Jenkins user is not added to the docker group. So first try to create a Jenkins user and add the user to the docker group. Follow the below steps:

1. Create a docker group if you haven’t done it already. 

$ sudo groupadd docker

2. Create a Jenkins user and add it to the docker group.

$ sudo usermod -aG docker $USER

3. Log off, restart your Jenkins and try executing the program. If you’re still getting the same error then change the access permission of the /var/run/docker.sock  by using the following command.

$ chmod 777 /var/run/docker.sock
answered Jun 26, 2018 by Sophie may
• 9,530 points
Thank you Man
I was struggling immensely on this part..this is what made my day...huge huge thanks
0 votes
Add Jenkins user to Docker group.
answered Apr 23 by Vismaya
0 votes

Change the permissions of the file:

$ chmod 777 /var/run/docker.sock
answered Apr 23 by Anusha
Thanks! That worked for me! :)
Thanks that worked for me...... Very useful.........

Related Questions In Docker

0 votes
1 answer

Error while trying to run an image - Docker

This error means that the container tries ...READ MORE

answered Aug 22, 2018 in Docker by Nilesh
• 6,880 points
1,380 views
0 votes
1 answer

How to create a container and run images in docker?

Look for what all images you have ...READ MORE

answered Feb 22 in Docker by Kalgi
• 40,460 points
88 views
0 votes
1 answer

Network timed out while trying to connect to https://index.docker.io

This happened because docker virtual machine gets ...READ MORE

answered Jul 27, 2018 in Docker by Kalgi
• 40,460 points
169 views
0 votes
1 answer
0 votes
1 answer
0 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
• 56,540 points
156 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 9,530 points
326 views
0 votes
1 answer