问题: 第三软件jenkins等,甚至docker本身都有可能报如下无权限操作的错误:
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.soc k/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
解决方法有2种: 建议第1种,不要用第2种!
# 1.查看docker.socker本体的权限,正确应该是root:docker,不应该是root:root,如下
# 查看权限
ll /lib/systemd/system/docker.socket /var/run/docker.sock
# -rw-r--r--. 1 root docker 295 Feb 10 03:48 /lib/systemd/system/docker.socket
# srwxrwxrwx 1 root docker 0 Apr 21 17:21 /var/run/docker.sock
# 修改属组为docker, chgrp和chown的区别一个只改属组一个属主属组全能改
chgrp docker /lib/systemd/system/docker.socket
chgrp docker /var/run/docker.sock
# 2.修改套接字文件docker.sock的权限为666,有可能重启后需要再次赋权限,如下:
ll /var/run/docker.sock
chmod 666 /var/run/docker.sock
ll /var/run/docker.sock
# srw-rw-rw-. 1 root docker 0 Nov 20 11:59 /var/run/docker.sock
标签:run,socket,sock,var,docker,root From: https://www.cnblogs.com/zhaolongisme/p/17347101.html