1、普通用户启动docker时遇到如下错误:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.26/build?
buildargs=%7B%7D&buildbinds=null&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7
D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=192.168.1.202%2Flibrary%2Ficp-service-interface%3Av2&ulimits=null:dial unix /var/run/docker.sock: connect:
permission denied
2、解决办法
2.1、添加docker用户组
groupadd docker
2.2、把当前用户加入docker用户组
gpasswd -a ${USER} docker
3、查看是否添加成功:
cat /etc/group | grep ^docker
4、重启docker
serivce docker restart
5、更新用户组
newgrp docker
6、测试docker命令是否可以使用sudo正常使用
docker ps