Score:1

How do I set permissions to use Docker with my normal user?

dz flag

I use Ubuntu 20.04 and I use docker to run images. When I installed and ran the docker command for the 1st time, the following error occurred in the shell.

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.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied

I ran sudo chmod 766 /var/run/docker.sock and it worked. However, whenever I restart the system, I have the permission denied again and I need to run chmod again.

How do I resolve this issue? I want to have root access always when running docker

Score:1
zw flag

You have to add your user to docker group by

sudo usermod -a -G docker $USER

and then reboot. As the result you will be able to run docker containers without sudo.

Next time please follow official docker installation guide more precisely.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.