Docker——避免每次执行docker都sudo用户密码
作者:
小T呀 | 来源:发表于
2021-03-15 12:26 被阅读0次
- 查看当前用户所属的组
执行groups
或执行id
或查看/etc/group
,同时查看发现已存在docker用户组
2.如果不存在docker用户组,需要创建docker组sudo groupadd docker
3.修改当前用户所属的组为docker
执行sudo usermod -aG docker zxt
一定-a
与-G
合用,为增加次要用户,非设置仅属于此次要用户组
4.重启docker
执行sudo systemctl restart docker
5.设置目录及其所有文件的权限
newgrp - docker
关于newgrp:The newgrp command is used to change the current group ID during a login session. If the optional - flag is given, the user's environment will be reinitialized as though the user had logged in, otherwise the current environment, including current working directory, remains unchanged.
本文标题:Docker——避免每次执行docker都sudo用户密码
本文链接:https://www.haomeiwen.com/subject/pfxkcltx.html
网友评论