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.
If you're running Jenkins inside a docker container and your Jenkins is linking to the host docker then you can fix that just by the Dockerfile below:
FROM jenkins/jenkins:2.179 USER root RUN groupadd docker && usermod -a -G docker jenkins USER jenkins