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.
I met the issue at bamboo-agent, but I assume the same holds for jenkins.
Add the user running maven to the docker group. Then restart docker AND the service running maven. Group changes are not loaded while the services are running. So in my case:
sudo groupadd docker # if it does not exist
sudo usermod -a -G docker bamboo-user
sudo systemctl restart docker.service
sudo systemctl restart bamboo-agent.service