permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
Most likely cause: The user running the Docker command is not a member of the docker group that owns the socket.
Try first: Check which groups the current user belongs to (groups)
Likely causes
- The user running the Docker command is not a member of the docker group that owns the socket.most likely
- The Docker daemon service is not running or the socket file has incorrect ownership.possible
- The socket file permissions were manually changed or a conflicting process is interfering.less likely
How to fix it
Check which groups the current user belongs toSafe
Run this command to see if 'docker' appears in the list. If it does not, that explains the permission error.
groupsVerify the Docker service is activeSafe
Check if the Docker daemon is running; if not, start it.
sudo systemctl status dockerAdd the current user to the docker groupChanges settings
This grants permission to use Docker without sudo. Log out and back in afterward for the change to take effect.
sudo usermod -aG docker $USER⚠ You must log out and log back in (or reboot) before the group membership applies.
Start the Docker service if it is stoppedChanges settings
Start the daemon so the socket becomes available.
sudo systemctl start docker
If that didn't fix it
Run 'ls -l /var/run/docker.sock' to inspect the socket file ownership and permissions directly.
When to see a technician
Contact a system administrator if you are on a company or shared machine where you cannot modify user groups.
Quick answers
- What does permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock mean?
- Docker cannot connect because the current user lacks permission to access the Docker daemon's socket file, which controls the Docker service.
- What causes permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock?
- The user running the Docker command is not a member of the docker group that owns the socket. (most likely) The Docker daemon service is not running or the socket file has incorrect ownership. (possible) The socket file permissions were manually changed or a conflicting process is interfering. (less likely)
- How do I fix permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock?
- Try these in order, safest first: 1. Check which groups the current user belongs to. 2. Verify the Docker service is active. 3. Add the current user to the docker group. 4. Start the Docker service if it is stopped.
- What if that didn't fix it?
- Run 'ls -l /var/run/docker.sock' to inspect the socket file ownership and permissions directly.
- When should I see a technician?
- Contact a system administrator if you are on a company or shared machine where you cannot modify user groups.