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.
DOCKER_OPTS=' -G jenkins'
/etc/default/docker
Then restart docker service by sudo service docker restart.
sudo service docker restart