I am running Jenkins in a docker container and Jenkins tries to run my maven build. As part of the build, the docker maven plugin instructs it to build a docker image.
As mentioned above by Rajith Delantha, this solved the problem for me:
Add: DOCKER_OPTS=' -G jenkins'
directly in /etc/default/docker
.
Then restart docker service by sudo service docker restart
.
I had the same issue with Jenkins.
Added jenkins to docker group
sudo usermod -aG docker jenkins
Then restrat jenkins.