I am new to docker. I just tried to use docker in my local machine(Ubuntu 16.04) with Jenkins.
I configured a new job with below pipeline script.
I have Jenkins running in Docker and connected Jenkins is using Docker socket from host machine Ubuntu 16.04 via volume to /var/run/docker.sock.
For me solution was:
1) Inside Docker container of Jenkins (docker exec -it jenkins bash
on host machine)
usermod -a -G docker jenkins
chmod 664 /var/run/docker.sock
service jenkins restart (or systemctl restart jenkins.service)
su jenkins
2) On host machine:
sudo service docker restart
664
means - read and write(but not execute) for owner and users from group.