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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…