title: How to access /var/run/docker.sock from inside a docker container as a non-root user? (MacOS Host)
body: <p>I have installed docker on Mac and everything is running fine. I am using a Jenkins docker image and running it. While using Jenkins as a CI server and to build further images by running docker commands through it, I came to know that we have to bind mount <code>/var/run/docker.sock</code> while running the Jenkins images so it can access the docker daemon.</p>
  
  <p>I did that, and installed docker CLI inside Jenkins’s container. But when running <code>docker ps</code> or any other docker commands it is throwing an error:</p>
  
  <pre><code>Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.28/containers/json: dial unix /var/run/docker.sock: connect: permission denied
  </code></pre>
  
  <p>When I connect to container as a root user, it works fine. But switching to the ‘jenkins’ user throws the above error. I have already added ‘jenkins’ user to sudo list but does not help.</p>
  
  <p>I found few articles suggesting to add ‘jenkins’ user to ‘docker’ group but to my surprise I do not find any docker group on Mac or inside container.</p>
  
  <p>Any help is much appreciated. Thanks</p>