Home > Blockchain >  Docker not found in Jenkins running locally in VM (not as a docker image)
Docker not found in Jenkins running locally in VM (not as a docker image)

Time:11-22

I am having trouble building from a public repo, installed Jenkins locally as a service add all the docker pipeline plugin but when I try to build I get this Error

 > git rev-list --no-walk d639281fcf8f6e5dab1cd633a0f7af0727ff7dc5 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] isUnix
[Pipeline] sh
  docker inspect -f . python:3.8.5
/var/lib/jenkins/workspace/testing_main@tmp/durable-3f16173e/script.sh: 1: docker: not found
[Pipeline] isUnix
[Pipeline] sh
  docker pull python:3.8.5
/var/lib/jenkins/workspace/testing_main@tmp/durable-09c8b637/script.sh: 1: docker: not found
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE

I am assuming that Jenkins is unable to run docker because it requires admin privileges in my vm (because I use sudo with every docker command)

How do you grant Jenkins permission to run docker commands as if I was using docker with sudo

CodePudding user response:

I think you should add jenkins user into docker group.

First execute

sudo groupadd docker

Then execute

sudo usermod -aG docker $USER

Or chmod 777 /path/to/docker.sock

  • Related