Docker Community Forums

Share and learn in the Docker community.

Unable to connect to Docker Daemon from Jenkins Docker Plugin on MacOS

(Yogesh Arora) #1

Hi there,

Just to tell you the background, I want to run Jenkins agents as Docker container. Jenkins Master is not running in a container. Therefore, I’ve installed Docker Plugin in my Jenkins. However, I’m unable to connect to Docker Daemon from Jenkins Docker Plugin. Getting the below error during Test Connection:

  1. When supply Docker Host URL as “unix://”, then
    connect(…) failed: Permission denied: /var/run/docker.sock

  2. When supply Docker Host URL as “tcp://” then
    Connection refused: /

MacOS: 10.13.4
Jenkins 2.89.3
Docker Plugin: 1.1.4

Any help in this regard is very appreciated.


(Archimedes Trajano) #2

The docker.sock file is owned by root and does not allow write permissions by other. You have to make it such that jenkins can read/write to that socket file when mounted. (That’s a bad idea though security wise)

To enable the docker host URL you need the host’s IP rather than which is the container’s localhost.

(Yogesh Arora) #3


Thanks a lot for your quick response.

In case of TCP, I had tried to use container’s localhost as well (i.e. tcp:// However, getting connection time-out error.

connection timed out: /

Is there any other setting on the daemon that could be missing ?

In case of unix://, I’m struggling to understand the docker group and which user needs to be added to docker group.

Can you please throw some light on these two issues? Many thanks in advance !


(Yogesh Arora) #4

Hi There,

Looks like, I hit this known issue due to which I’m unable to connect to Docker host.


(Archimedes Trajano) #5

That’s still an internal IP address, do you have an IP address that other computers in your network (not the same machine) can access services you expose? And if so see if you nc -z -v IPADDRESS 2376

(Yogesh Arora) #6

I’m running both Jenkins and Docker on the same mac laptop.

(Yogesh Arora) #7


I’m able to successfully run this with socat.
sudo socat tcp-listen:2375,reuseaddr,fork,bind= unix-client:/var/run/docker.sock,su=root

Is there a better to run this on Mac ? If not, I would have to live with this solution for the time being.