Docker / Docker
Docker permission denied
Fix Docker permission denied errors when running docker commands or mounting files.
- Category
- Docker
- Error signature
permission denied while trying to connect to the Docker daemon socket- Quick fix
- Start Docker and make sure your user has permission to access the Docker daemon.
- Updated
What this error means
Docker permission denied errors mean the Docker client, daemon, or container process tried to access a file, socket, or directory without enough operating system permissions.
Common causes
- The Docker daemon is not running.
- Your Linux user is not in the
dockergroup. - The Docker socket is owned by
rootand the command is running as an unprivileged user. - A bind mount maps host files that the container user cannot read or write.
Quick fixes
-
Confirm Docker is running:
docker version -
On Linux, add your user to the Docker group:
sudo usermod -aG docker "$USER" -
Log out and back in so the group change applies.
-
Retry the Docker command.
Step-by-step troubleshooting
- Run
docker infoand check whether the daemon responds. - Inspect
/var/run/docker.sockownership withls -l /var/run/docker.sock. - If the failure happens inside a container, check the container user with
id. - For bind mounts, compare host file ownership with the UID and GID used in the container.
- Avoid using
sudoas a permanent workaround for development workflows; fix the daemon or file permissions instead.
Related errors
Cannot connect to the Docker daemonGot permission denied while trying to connect to the Docker daemon socketEACCES: permission denied
FAQ
Is it safe to add my user to the Docker group?
Only do this on machines where you trust the user account. Docker group access is powerful and can effectively grant root-level control.
Why does the error happen only with volumes?
The container process may run as a different user than your host user, so mounted files can become unreadable or unwritable.
Does Docker Desktop need the docker group?
Usually no. Docker Desktop manages access differently on macOS and Windows.