简体   繁体   中英

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

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

I think you should add jenkins user into docker group.

First execute

sudo groupadd docker

Then execute

sudo usermod -aG docker $USER

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM