普通用户使用docker命令,每次都要sudo,可以用以下命令加入到用户组中。
sudo usermod -aG docker xxxx
xxxx替换为用户名。
成功后重启或使用newgrp docker命令生效。