What This Error Means
Docker denied access to the daemon socket due to insufficient permissions.
How to Fix It
- On Linux, add your user to the docker group:
sudo usermod -aG docker $USER(then re-login). - As a quick test, run the same command with
sudo(do not rely on this long-term). - 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
dockergroup (Linux). - The Docker socket has restrictive permissions.
- A security policy (SELinux/AppArmor) is blocking access.
How to Verify
- Re-run
docker versionwithout 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.
Common CLI Output
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sockGot 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.
- Avoid running Docker commands as root unless required by policy.