Home > Enterprise >  docker commands without sudo user even after adding groupadd
docker commands without sudo user even after adding groupadd

Time:01-05

even after adding sudo groupadd docker and sudo usermod -aG docker $USER , i cannot use docker commands without sudo

`Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http:///var/run/docker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied.

So I had to use "sudo". How can I get ignored sudo in docker commands

CodePudding user response:

Create a group called docker and add yourself to it using the commands

sudo groupadd docker
sudo usermod -aG docker $USER

Then you can run docker commands without using sudo.

CodePudding user response:

Try restarting docker.

sudo groupadd docker
sudo usermod -aG docker $USER
sudo service docker restart

CodePudding user response:

Giving more access to this file solves the problem, but it is not recommended it gives every local process and user unrestricted root access over the host!

chmod 777 /var/run/docker.sock

then you don't need to use sudo but it's not recommended.

  •  Tags:  
  • Related