Docker works halfway in Jenkins

26 views
Skip to first unread message

ter...@gmail.com

unread,
Dec 3, 2016, 2:00:02 PM12/3/16
to Jenkins Users
Inside Pipeline this works 

   sh 'docker info'


But if I do:

  sh 'python mycode.py'

I get an error:

    Unable to locate docker daemon

I did the usermod -aG command and verified Jenkins is partof the docker group.

Is DOCKER_HOST missing from inside of Pipeline?

    sh 'whoami'

...does reveal "Jenkins"

Bottom line, docker commands work directly from Pipeline but not using the "subprocess" package inside of Python.

Not sure what I should try next.

Thanks...
Bruno Terkaly

Message has been deleted

ter...@gmail.com

unread,
Dec 3, 2016, 2:51:17 PM12/3/16
to Jenkins Users
Duh. I needed to reboot/restart, blah, blah. Jenkins maybe docker too need a restart. I just got mad and typed "reboot."

After the reboot, the Jenkins green circle appeared after a build.

The success factor is this

Make sure Jenkins is in Docker as a user

This was the key:

    sudo usermod -aG docker jenkins

Now verify

    grep ^docker /etc/group
    docker:x:120:root,jenkins


Yeah! - Jenkins is there.

25 years as a developer and I still forget to reboot.

YAMR = Yet another missing reboot
- show quoted text -
Reply all
Reply to author
Forward
0 new messages