docker需要root用户启动守护进程
[root@yang ~]# useradd yang
[root@yang ~]# usermod -a -G docker yang
[root@yang ~]# id yang
uid=1002(yang) gid=1002(yang) 组=1002(yang),994(docker)
[root@yang ~]# groups yang
yang : yang docker
# 使用root用户停止docker
[root@yang ~]# systemctl stop docker
Warning: Stopping docker.service, but it can still be activated by:
docker.socket
# 切到yang用户
[root@yang ~]# su - yang
# 尝试启动docker
[yang@yang ~]$ systemctl start docker
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units. # 管理系统服务或单元需要身份验证
Authenticating as: root # 身份验证为:root
Password: # 需要输入root密码才能启动docker