[workflow-plugin] docker sh steps hang

427 views
Skip to first unread message

Ross Vandegrift

unread,
Oct 1, 2015, 12:28:54 PM10/1/15
to jenkins...@googlegroups.com
Hello all,

I'm using the workflow plugin with the jenkins:latest docker container,
and I need to run jobs inside of other containers. I've given jenkins
access to /var/run/docker.sock and it can run a new container from a
workflow.

But if there's a sh step in that container, the jenkins job freezes.
Symptoms are the same as [1], but I don't think write access is the
issue. Te workspace dir has mode 0777, and jenkins is running as root.

Jenkins successfully creates the script for the sh step, but either it
runs and misses the result, or it never executes:
root@ab9ed8e40baf:/var/jenkins_home/jobs/docker-example/workspace# ls -laR
.:
total 12
drwxrwxrwx 3 root root 4096 Sep 28 15:39 .
drwxr-xr-x 4 root root 4096 Sep 28 15:07 ..
drwxr-xr-x 2 root root 4096 Sep 28 15:07 .3413c672

./.3413c672:
total 12
drwxr-xr-x 2 root root 4096 Sep 28 15:07 .
drwxrwxrwx 3 root root 4096 Sep 28 15:39 ..
-rwxr-xr-x 1 root root 18 Sep 28 15:07 script.sh
root@ab9ed8e40baf:/var/jenkins_home/jobs/docker-example/workspace# cat
.3413c672/script.sh
#!/bin/sh -xe
true


Any hints?

Ross

[1] - https://issues.jenkins-ci.org/browse/JENKINS-28821

Ross Vandegrift

unread,
Oct 1, 2015, 12:28:54 PM10/1/15
to jenkins...@googlegroups.com
Hello all,

I'm using the workflow and docker workflow plugins to run jenkins jobs
with steps executed inside of docker containers. Things are sort of
working - containers get run, but any sh step in a container causes the
job to hang forever.

Symptoms are the same as [1], but I don't think write access is the
issue. The workspace dir has mode 0777, and jenkins is running as root.

Jenkins successfully creates the script for the sh step, but either it
runs and misses the result, or it never executes:

/var/jenkins_home/jobs/docker-example/workspace# ls -laR
.:
total 12
drwxrwxrwx 3 root root 4096 Sep 28 15:39 .
drwxr-xr-x 4 root root 4096 Sep 28 15:07 ..
drwxr-xr-x 2 root root 4096 Sep 28 15:07 .3413c672

./.3413c672:
total 12
drwxr-xr-x 2 root root 4096 Sep 28 15:07 .
drwxrwxrwx 3 root root 4096 Sep 28 15:39 ..
-rwxr-xr-x 1 root root 18 Sep 28 15:07 script.sh

/var/jenkins_home/jobs/docker-example/workspace# cat .3413c672/script.sh
#!/bin/sh -xe
true

Any hints? I'm reproducing with the following workflow script:


node {
withDockerContainer('ubuntu:latest') {
sh 'true'
}
}


Thanks,

Kris Musard

unread,
Nov 16, 2015, 4:30:24 PM11/16/15
to Jenkins Users
In my case I was able to get sh commands working inside the container by adding a user to the docker image with the uid/gid that was being specified on the docker run command executed by the plugin (the local jenkins userid and group).
Reply all
Reply to author
Forward
0 new messages