普通用户直接使用docker命令

sudo groupadd docker
sudo usermod -aG dockerroot abc
sudo usermod -aG docker abc
cat /etc/group #检查是否生效。
sudo systemctl restart docker,重启docker镜像
如果提示权限不够,如下:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/json: dial unix /var/run/docker.sock: connect: permission denied
则修改/var/run/docker.sock权限.
sudo chmod a+rw /var/run/docker.sock

docker logs –follow –tail 10