添加用户组,将用户添加到组
sudo gpasswd -a $USER docker
grep docker /etc/group
重新登录就好了
或者执行下面的 重启docker即可
[root@localhost ~]# groupadd docker
[root@localhost ~]# groups
root
[root@localhost ~]# usermod -a -G docker simon
[root@localhost ~]# grep docker /etc/group
dockerroot:x:994:
docker:x:1001:simon
[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost ~]# sudo simon
[simon@localhost ~]$ docker image ls