What This Error Means
Docker cannot access /var/run/docker.sock because your user lacks permission to the daemon socket or the socket ownership is wrong.
How to Fix It
On Linux, add your user to the docker group:sudo usermod -aG docker $USER (then log out/in or run newgrp docker).
As a quick test, run the same command with sudo (do not rely on this long-term).
Avoid chmod 666 /var/run/docker.sock unless you fully understand the security impact.
Check socket permissions:ls -la /var/run/docker.sock
If SELinux/AppArmor is enabled, review the policy denial logs.
Why It Happens
Your user is not in the docker group (Linux).
The Docker socket has restrictive permissions.
A security policy (SELinux/AppArmor) is blocking access.
How to Verify
Re-run docker version without sudo and confirm the server info is shown.
Retry the original command.
Manual daemon access checks
Print groups:groups
Check daemon socket:stat /var/run/docker.sock
Examples
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: connect: permission denied Prevention Tips
Provision CI runners with correct docker group membership.
On Linux, treat membership in the docker group as root-equivalent access and restrict it to trusted users.
Avoid running Docker commands as root unless required by policy.