title: Docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
body: <p>I am new to docker. I just tried to use docker in my local machine(Ubuntu 16.04) with Jenkins.</p>
  <p>I configured a new job with below pipeline script.</p>
  <pre class="lang-groovy prettyprint-override"><code>node {
      stage('Build') {
        docker.image('maven:3.3.3').inside {
          sh 'mvn --version'
        }
      }
  }
  </code></pre>
  <p>But it fails with this error:</p>
  <blockquote>
  <p>Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/nz6Ig.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nz6Ig.png" alt="enter image description here" /></a></p>