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
• 640 points
2,823 views

3 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,330 points
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,900 points
566 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
• 36,260 points
64 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
• 36,260 points
96 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,140 points
79 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,330 points
238 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.