Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:
The error itself saying that jenkins user doesn't have the permissions over docker. Follow the below steps to resolve this problem.
Step1: Login to the Jenkins server as root via ssh.
Step2: Add Jenkins user to the group docker.
#usermod -aG docker jenkins
Step3: Restart jenkins service.
#systemctl restart jenkins