Why might the Jenkins user not have permission to access the Docker unix socket?

Solution 1:

I think giving jenkins group privileges to docker unix socket solves the issue. This can be modified with configuring docker daemon startup options in configuration file by adding this line

DOCKER_OPTS=' -G jenkins'

In ubuntu /etc/default/docker is the docker configuration file.

Solution 2:

Run groups command using jenkins. Do you see a docker group? If not, try to reboot that Jenkins slave. Or just kill the Jenkins slave.jar process: ps aux|grep jenkins