Founding prices until 15 December: 30% off Pro, locked for life. See pricing

$ … permission denied while trying to connect to the Docker daemon socket

'permission denied ... Docker daemon socket': without using sudo for everything

Your user can't open /var/run/docker.sock.

Docker

What it means

The Docker CLI talks to the daemon through a Unix socket owned by root and the docker group. Users outside that group get this error. Membership in the docker group is effectively root, so grant it deliberately.

Causes and fixes

Most likely first. Run the check, and if it matches, apply the fix.

1. The user isn't in the docker group, or hasn't logged in again since being added

Check:

ls -l /var/run/docker.sock
id

Fix: sudo usermod -aG docker $USER, then log out and in (or newgrp docker). Consider rootless Docker instead.

Fix it yourself

A live machine in your browser with this problem already on it. The grader checks the result.

Open the lab

No account needed for your first tries.

Related errors

  • Permission denied

    The user the process runs as lacks the read, write or execute right on the file or a directory on its path.