参考:
https://zhuanlan.zhihu.com/p/568513293
使用Jenkins构建时使用的用户为jenkins
在使用docker命令时会报以下错误
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
解决方法
把jenkins加入用户组
# usermod -aG docker jenkins
设置sock文件权限
# sudo chmod 666 /var/run/docker.sock
重启docker和jenkins
# systemctl restart docker
# systemctl restart jenkins
标签:run,sock,jenkins,var,Jenkins,docker,权限
From: https://www.cnblogs.com/minseo/p/18028949