Docker “permission denied” on the daemon socket: join the docker group
Add your user to the docker group and re-login, or fix root-owned ~/.docker/ files.
On Linux, add your user to the docker group with sudo usermod -aG docker $USER, then log out and back in. If you used sudo before, fix ~/.docker/ ownership too.
Try these fixes in order
Check group membership
Confirm your user is missing from the docker group. If docker is absent from the group list, that is the cause.
id -nGAdd your user to the docker group
Create the group if needed and add your user. The -aG flags append without removing existing groups.
sudo groupadd dockersudo usermod -aG docker $USERRe-login to apply the group
Group membership is evaluated at login, so log out and back in (a new terminal alone is not enough). Verify with id -nG, then test docker run hello-world without sudo.
newgrp dockerFix root-owned Docker config
If the error persists after the group fix, root-owned files in ~/.docker/ are the culprit from earlier sudo use. Remove the directory (it is recreated) or chown it back to your user.
sudo chown -R $USER:$USER ~/.dockerInterpret what you see
The message mentions unix:///var/run/docker.sock
What it suggests: The error names the Unix socket path, which means the daemon is reachable but your user lacks access to it. This is a permissions problem, not a stopped daemon.
Next check: Check whether your user is in the docker group with id -nG.
Group membership is correct but the error persists
What it suggests: An earlier sudo docker run created ~/.docker/ files owned by root, so the CLI cannot read its own config without sudo even after the group fix.
Next check: Run ls -la ~/.docker/ and check for root-owned files.
You are on macOS or Windows rather than Linux
What it suggests: On Docker Desktop for Mac or Windows this error usually means the Desktop engine is not running, not a Unix group problem.
Next check: Open Docker Desktop and wait for the engine status to report running.
Why this happens
- Your user is not in the docker group, so the daemon's root-owned Unix socket rejects the connection.
- You previously ran docker with sudo, which left ~/.docker/ owned by root and breaks subsequent non-sudo runs.
Still not working?
Do not chmod 777 the Docker socket or run everything as root to work around this. The docker group grants root-equivalent privileges by design; add only users you trust, and never expose an unauthenticated TCP daemon socket as a substitute.
Official sources
These steps are based on the linked documentation and general diagnostics. BugMedic has not independently tested every product and system configuration. Review commands before running them.