sudo 和 wheel组
查看docker
用户信息,
1
2
| id docker
uid=1001(docker) gid=1001(docker) groups=1001(docker)
|
docker
用户没有加入/etc/sudoers
,因此sudo
命令失败。
1
2
3
| [docker@cheney-hp etc]$ sudo ip addr
[sudo] password for docker:
docker is not in the sudoers file. This incident will be reported.
|
解决该问题有两种方式,一种是把docker
加入/etc/sudoers
,例如echo 'docker ALL=(ALL) ALL' >> /etc/sudoers
,另一种方式是把docker
加入wheel
用户组。
1
| sudo gpasswd -a docker wheel
|
1
2
3
4
5
6
7
8
| [docker@cheney-hp etc]$ sudo ip addr
[sudo] password for docker:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
|