Docker: Got permission denied while trying to connect to the Docker daemon socket
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.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
Immediate Remediation
bash
sudo usermod -aG docker $USER && newgrp docker
Root Cause Analysis
The current user lacks permission to access the Docker daemon Unix socket, which is owned by root and the docker group. Adding the user to the docker group grants the necessary read/write access to the socket.
Verification & Guardrails
- This changes group membership; you must log out and back in (or use 'newgrp docker') for the change to take effect.
- If the user is already in the docker group, verify the socket ownership and permissions with 'ls -l /var/run/docker.sock' and check if the Docker daemon is running.
- Running Docker commands with 'sudo' is generally discouraged; prefer group-based access for security and correctness.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.