title: Permission Denied while trying to connect to Docker Daemon while running Jenkins pipeline in Macbook
body: <p>I am trying to run Jenkins pipeline job in my macbook. I also have docker instance running locally. Initially I got the "<strong>docker command not found</strong>" error while running the Jenkins Job. I fixed the error by adding a symlink "<strong>ln -f -s /Applications/Docker.app/Contents/Resources/bin/* /usr/local/bin</strong>"</p>
  
  <p>I also applied these two changes so that jenkins user has the access to the docker directory</p>
  
  <ol>
  <li>chmod -R 777 /Users/myUserName/Library/Containers/com.docker.docker/</li>
  <li>chmod -R 777 /Users/myUserName/Library/Containers/com.docker.helper/</li>
  </ol>
  
  <p><strong>I am getting below errors</strong>:</p>
  
  <blockquote>
    <p>Got permission denied while trying to connect to the Docker daemon
    socket at unix:///var/run/docker.sock: Get
    <a href="http://%2Fvar%2Frun%2Fdocker.sock/v1.27/containers/openjdk:8/json" rel="noreferrer">http://%2Fvar%2Frun%2Fdocker.sock/v1.27/containers/openjdk:8/json</a>:
    dial unix /var/run/docker.sock: connect: permission denied
        [Pipeline] sh
        [test] Running shell script
        + docker pull openjdk:8
        Warning: failed to get default registry endpoint from daemon (Got permission denied while trying to connect to the Docker daemon socket
    at unix:///var/run/docker.sock: Get
    <a href="http://%2Fvar%2Frun%2Fdocker.sock/v1.27/info" rel="noreferrer">http://%2Fvar%2Frun%2Fdocker.sock/v1.27/info</a>: dial unix
    /var/run/docker.sock: connect: permission denied). Using system
    default: <a href="https://index.docker.io/v1/" rel="noreferrer">https://index.docker.io/v1/</a>
        Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post
    <a href="http://%2Fvar%2Frun%2Fdocker.sock/v1.27/images/create?fromImage=openjdk&amp;tag=8" rel="noreferrer">http://%2Fvar%2Frun%2Fdocker.sock/v1.27/images/create?fromImage=openjdk&amp;tag=8</a>:
    dial unix /var/run/docker.sock: connect: permission denied
        [Pipeline] }
        [Pipeline] // node
        [Pipeline] End of Pipeline
        ERROR: script returned exit code 1
        Finished: FAILURE</p>
  </blockquote>