title: docker: Got permission denied while trying to connect to the Docker daemon socket
body: <p>on the Ubuntu 18.04 system I have cloned a project and to run it needs <code>gradle</code> but at running the gradle command <code>gradle swiplRun</code> I get the following error</p>
  
  <blockquote>
    <p>Task :dockerRun FAILED
    docker: 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.39/containers/create?name=swiprolog" rel="noreferrer">http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/create?name=swiprolog</a>: dial unix /var/run/docker.sock: connect: permission denied.
    See 'docker run --help'.</p>
    
    <p>Task :dockerRunStatus FAILED
    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.39/containers/swiprolog/json" rel="noreferrer">http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/swiprolog/json</a>: dial unix /var/run/docker.sock: connect: permission denied</p>
    
    <p>FAILURE: Build completed with 2 failures.</p>
  </blockquote>
  
  <p>to solve I tried </p>
  
  <pre><code>$ sudo groupadd docker
  $ sudo usermod -a -G docker myname  
  "and once with"
  $ sudo gpasswd -a myname docker
  </code></pre>
  
  <p>so I can run docker commands without sudo, but the same error
  also <code>./gradlew --stop</code> and logout/login and reboot did not work too.</p>
  
  <p>is it because of Docker or Gradle?</p>