I deployed the standard Jenkins Docker image with docker-compose and this configuration:
deployer:
image: jenkins
volumes:
- "/mnt/jenkins:/var/jenkins_home"
- "/var/run/docker.sock:/var/run/docker.sock"
ports:
- "2375:2375"
- "8080:8080"
- "50000:50000"
After reading numerous SO questions I tested added Root to the docker user group with gpasswd -a ${USER} docker
and verified that the user inside the Container is Root with docker exec jenkins_deployer echo ${USER}
.
When I try to add Docker access inside the Jenkins UI with "Docker URL = unix:///var/run/docker.sock" I get the error message "org.newsclub.net.unix.AFUNIXSocketException: Permission denied (socket: /run/docker.sock)"
How can I give Jenkins access to docker.sock to automatically deploy Docker Containers?