1

I am running Docker on Linux Mint 20 (ubuntu 20.04 base). I have installed docker through the software manager app.

I am trying to run docker commands without using sudo, but they are still not working. Docker is installed. When I run just the docker command, it gives me the expected output.

Observe the following terminal output. I have added my current user to the 'docker', yet permission issues still persist.

myUser@myUser-devDesktop:~$ sudo usermod -a -G docker ${USER}
[sudo] password for myUser:           
myUser@myUser-devDesktop:~$ grep 'docker' /etc/group
docker:x:137:myUser
myUser@myUser-devDesktop:~$ docker images ls
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/json?filters=%7B%22reference%22%3A%7B%22ls%22%3Atrue%7D%7D: dial unix /var/run/docker.sock: connect: permission denied
myUser@myUser-devDesktop:~$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
myUser@myUser-devDesktop:~$ 

1 Answer 1

3

Adding yourself to a group with adduser or usermod is not effective until you've run a suitable PAM invocation, since PAM is usually responsible for setting the user and group IDs for your process. Right now, you've told the system configuration files that when you log in, you should be granted membership in the docker group, but that doesn't affect your current session.

You can either log out and log back in again, which will cause your new session to have the proper group, or run su - myUser to spawn a new shell with the new privileges.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .