title: Error pinging docker server on "terraform apply"
body: <p>I am doing the terraform tutorial and reach the step to execute <code>terraform apply</code>.</p>
  <p>After executing that command I get this error:</p>
  <pre><code>WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
  
  Error: Error pinging Docker server: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get &quot;http://%2Fvar%2Frun%2Fdocker.sock/_ping&quot;: dial unix /var/run/docker.sock: connect: permission denied
  
    on main.tf line 9, in provider &quot;docker&quot;:
     9: provider &quot;docker&quot; {
  </code></pre>
  <p>This is what I have in my configuration <code>main.tf</code>file:</p>
  <pre><code>terraform {
    required_providers {
      docker = {
        source = &quot;kreuzwerker/docker&quot;
      }
    }
  }
  
  provider &quot;docker&quot; {
    
  }
  
  resource &quot;docker_image&quot; &quot;nginx&quot; {
    name         = &quot;nginx:latest&quot;
    keep_locally = false
  }
  
  resource &quot;docker_container&quot; &quot;nginx&quot; {
    image = docker_image.nginx.latest
    name  = &quot;tutorial&quot;
    ports {
      internal = 80
      external = 8000
    }
  }
  </code></pre>
  <p>I have tried adding <code>host = &quot;unix:///var/run/docker.sock&quot;</code> in the provider function but still get that error. I have docker and NGINX configured in my pc too.</p>
  <p>Does anyone know what is causing it?</p>