title: Preparation failed: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
body: <p>Trying to transform a project in gitlab to docker image. The gitlab is selfhosted. This is the error I get:</p>
  <pre><code>Running with gitlab-runner 13.12.0 (7a6612da)
  on test -KnwQXuT
  Preparing the &quot;docker&quot; executor
  ERROR: Failed to remove network for build
  ERROR: Preparation failed: 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.25/info: dial 
  unix /var/run/docker.sock: connect: permission denied (docker.go:858:0s)
  </code></pre>
  <p>I added a runner,registered it,  created a gitlab-ci.yml with docker template which I left unmodified. As solutions I tried <code>chmod 666 /var/run/docker.sock</code> before and after adding the runner but it did not work. I also added sudo before running and registering the docker runner but still no success. I found another option to add my docker user to group docker but all my users are in the docker group. The docker runner is run as a docker image. I did not know what to do...Please help. I`m am trying for about 10 days with no success... Thanks in advance</p>