Jenkins pipeline build fails to run script inside Docker container

252 views
Skip to first unread message

Ramanathan Muthaiah

unread,
Apr 5, 2017, 1:10:52 AM4/5/17
to Jenkins Users
Hello All,

Using standard + Pipeline + Docker plugins in Jenkins v2.53, am trying to run flake8 within a Docker container environment.

1. Jenkins master is running in a Vagrant VM and there is no dedicated agent as this is meant for experimentation and learning purposes.

2. Docker toolbox is installed on the Jenkins master and pipeline build is set to run in the master.

3. In the Jenkins master:

ubuntu@ubuntu-xenial:~$ grep 112 /etc/passwd
uuidd:x:108:112::/run/uuidd:/bin/false
jenkins:x:112:117:Jenkins,,,:/var/lib/jenkins:/bin/bash


4. via pipeline, with Dockerfile as input, pipeline build is able to create image.

jenkins@ubuntu-xenial:~$ docker images flake8-node
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
flake8-node         latest              7c6e568293f3        22 hours ago        277 MB


5. Manually launched the docker container using the built image to check "jenkins" user:

jenkins@ubuntu-xenial:~$ docker run -ti flake8-node:latest
. . . .
. . . .
jenkins@513b3c3988ca:/data$ id
uid=1000(jenkins) gid=1001(jenkins) groups=1001(jenkins),1000(docker)

However, during pipeline build, while attempting to execute flake8 shell script using "docker.inside", build fails with this error:

docker run -t -d -u 112:117 args . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
"fatal: unable to lookup current user in the passwd file: no such user"

Mining through the archives, I found this thread related to this issue but there isn't any conclusion.

https://groups.google.com/forum/#!searchin/jenkinsci-users/docker$20containers%7Csort:relevance/jenkinsci-users/dMxdQrJJAOg/ueBtrl1LCQAJ

Any ideas welcome !!!

/Ram
Reply all
Reply to author
Forward
0 new messages