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