Skip to content

Instantly share code, notes, and snippets.

@diatmpravin
Created November 3, 2016 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diatmpravin/b55a133c508e97071b04ed6c099cd562 to your computer and use it in GitHub Desktop.
Save diatmpravin/b55a133c508e97071b04ed6c099cd562 to your computer and use it in GitHub Desktop.
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
Now it's time to reload and restart your Docker daemon
systemctl daemon-reload
systemctl restart docker
Then I restarted jenkins and I was able to perform docker commands as jenkins user in my jenkins jobs
sudo service jenkins restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment