简体   繁体   中英

docker commands failing in jenkins shell step

I have installed docker on my RHEL slaves

and have given permissions to "tomcat" user

sudo usermod -aG docker tomcat

I am able to run this command "docker run hello-world" as tomcat user on the box directly, but when I am running the same through Jenkins its failing

Running Prebuild steps
[docker-test] $ /bin/sh -xe /tmp/jenkins5880049234473840635.sh
+ whoami
tomcat
+ docker -v
Docker version 1.12.6, build 96d83a5/1.12.6
+ docker run hello-world
/usr/bin/docker-current: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See '/usr/bin/docker-current run --help'.
Build step 'Execute shell' marked build as failure

you give the permission to "tomcat" user.. Is it your jenkins ssh user? (user used to connect on slave?) if yes, you must restart your jenkins (i had this problem)

else you must give permission to the user used to connect on slave and restart your jenkins

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