Users will be removed from each input docker group sudo

After installing the docker, each time you enter a command docker be prefixed with sudo, very annoying, we join docker current user groups do not need to have to keep entering the sudo

 

See if there docker group

sudo cat /etc/group | grep docker

 

View the current user input that group

groups

 

View a user belongs to which group

groups ${user name}

 

The user group is added docker, $ {USER}, it means that the user name

sudo gpasswd -a ${USER} docker 

 

Restart docker Service

sudo service docker restart 

or

sudo systemctl restart docker

 

Switching the current session to a new group or restart X session 

newgrp  docker

or

pkill X 

Or use the  exit  to exit the current session command to log in again

 

Note: The last step is necessary, the group just added information not entered into force because the session is still using the old cache inside information, so docker images execution was also unable to get rid of sudo.

 

Reference connection

 

View user group, join user groups
https://www.cnblogs.com/pengyunjing/p/8543026.html

 

Guess you like

Origin www.cnblogs.com/majestyking/p/11258724.html