docker.sock permission denied

For those new to the shell, the command:

$ sudo usermod -aG docker $USER

needs to have $USER defined in your shell. This is often there by default, but you may need to set the value to your login id in some shells.


Changing the groups of a user does not change existing logins, terminals, and shells that a user has open. To avoid performing a login again, you can simply run:

$ newgrp docker

to get access to that group in your current shell.


Once you have done this, the user effectively has root access on the server, so only do this for users that are trusted with unrestricted sudo access.

Leave a Comment