Monday, December 7, 2015

Docker permission denied error with Jenkins in Ubuntu 16.04

Are you trying to run docker commands from a Jenkins shell script and getting permission problems ?

Warning: failed to get default registry endpoint from daemon
(Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:
Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/info: dial unix /var/run/docker.sock: connect: permission denied). Using system default: https://index.docker.io/v1/
Got permission denied while trying to connect to the Docker daemon socket at
unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.26/images/create?fromImage=node&tag=6.3: dial unix /var/run/docker.sock: connect: permission denied

Jenkins runs with user name "jenkins" . You have to add this user to docker group.

sudo usermod -aG docker jenkins

Restart the jenkins fromcommand line ( not jenkins UI )

sudo service jenkins restart


No comments:

Post a Comment