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.
In my case this will work successfully. navigate your local repo and enter this command.
sudo chmod 666 /var/run/docker.sock