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:
When supply Docker Host URL as “unix://127.0.0.1:2375”, then
connect(…) failed: Permission denied: /var/run/docker.sock
When supply Docker Host URL as “tcp://127.0.0.1:2375” then
Connection refused: /127.0.0.1:2375
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 127.0.0.1 which is the container’s localhost.
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
@udoyen : Just use the network IP instead of localhost when starting socat on the mac.
docker run -d --restart=always
-p <my_network_ip>:2376:2375
-v /var/run/docker.sock:/var/run/docker.sock
alpine/socat
tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock