Jenkins: Can't connect to Docker daemon
After the installation of Jenkins and Docker.Add jenkins user to dockergroup (like you did)
sudo gpasswd -a jenkins docker
Edit the following file
vi /usr/lib/systemd/system/docker.service
And edit this rule to expose the API :
ExecStart=/usr/bin/docker daemon -H unix:// -H tcp://localhost:2375
Do not create a new line with ExecStart
, simply add the commands at the end of the existing line.
Now it's time to reload and restart your Docker daemon
systemctl daemon-reloadsystemctl restart docker
Then restart jenkins, you should be able to perform docker commands as jenkins user in your jenkins jobs
sudo service jenkins restart
I had the same issue with Jenkins.
I did fix it by adding /var/run/docker.sock:/var/run/docker.sock on docker-compose.yml :
jenkins: container_name: jenkins build: "jenkins/" ports: - "8080:8080" environment: - JAVA_OPTS:-Djava.awt.headless=true volumes: - /var/jenkins_home - /var/run/docker.sock:/var/run/docker.sock