[JIRA] (JENKINS-53259) Jenkins Pipeline build fails when trying to jenkins docker plugin

16 views
Skip to first unread message

siddhant.gogri@aqr.com (JIRA)

unread,
Aug 27, 2018, 1:40:02 PM8/27/18
to jenkinsc...@googlegroups.com
Siddhant Gogri created an issue
 
Jenkins / Bug JENKINS-53259
Jenkins Pipeline build fails when trying to jenkins docker plugin
Issue Type: Bug Bug
Assignee: Nicolas De Loof
Components: docker-plugin
Created: 2018-08-27 17:39
Priority: Major Major
Reporter: Siddhant Gogri

I have Jenkins master running in a docker container and using jenkins docker plugin, I am spawning a jenkins slave (jnlp) on a remote machine. 

Now, using my declarative pipelines I build my project where i spawn another docker container for builds (inside the slave container spawned by docker plugin)

This works if the build step has "echo". But when i try to run "sh" in build steps where sh just has "python --version" it gives the following error

sh: /workspace/conda-test_master-UI6XA7VOZBDYE3YLPHIIQRESPXQMQIXWNY5GVA2M2NXDSM24G6VA@tmp/durable-250f016b/jenkins-log.txt: No such file or directory
sh: /workspace/conda-test_master-UI6XA7VOZBDYE3YLPHIIQRESPXQMQIXWNY5GVA2M2NXDSM24G6VA@tmp/durable-250f016b/jenkins-result.txt.tmp: No such file or directory
mv: cannot stat '/workspace/conda-test_master-UI6XA7VOZBDYE3YLPHIIQRESPXQMQIXWNY5GVA2M2NXDSM24G6VA@tmp/durable-250f016b/jenkins-result.txt.tmp': No such file or directory

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

siddhant.gogri@aqr.com (JIRA)

unread,
Aug 27, 2018, 1:43:02 PM8/27/18
to jenkinsc...@googlegroups.com
Siddhant Gogri updated an issue
Change By: Siddhant Gogri
I have Jenkins master running in a docker container and using jenkins docker plugin, I am spawning a jenkins slave (jnlp) on a remote machine. 

Now, using my declarative pipelines I build my project where i spawn another docker container for builds (inside the slave container spawned by docker plugin)

This works if the build step has "echo". But when i try to run "sh" in build steps where sh just has "python --version" it gives the following error

sh: /workspace/conda-test_master-UI6XA7VOZBDYE3YLPHIIQRESPXQMQIXWNY5GVA2M2NXDSM24G6VA@tmp/durable-250f016b/jenkins-log.txt: No such file or directory
sh: /workspace/conda-test_master-UI6XA7VOZBDYE3YLPHIIQRESPXQMQIXWNY5GVA2M2NXDSM24G6VA@tmp/durable-250f016b/jenkins-result.txt.tmp: No such file or directory
mv: cannot stat '/workspace/conda-test_master-UI6XA7VOZBDYE3YLPHIIQRESPXQMQIXWNY5GVA2M2NXDSM24G6VA@tmp/durable-250f016b/jenkins-result.txt.tmp': No such file or directory

zougi.fr@gmail.com (JIRA)

unread,
Mar 7, 2019, 1:55:19 AM3/7/19
to jenkinsc...@googlegroups.com

zougi.fr@gmail.com (JIRA)

unread,
Mar 7, 2019, 1:55:33 AM3/7/19
to jenkinsc...@googlegroups.com
Frederic Rousseau commented on Bug JENKINS-53259
 
Re: Jenkins Pipeline build fails when trying to jenkins docker plugin

I just reproduced this exact issue on latest version of jenkins+docker plugin. I am adding component docker-workflow-plugin to the issue

zougi.fr@gmail.com (JIRA)

unread,
Mar 7, 2019, 1:56:02 AM3/7/19
to jenkinsc...@googlegroups.com

nicolas.deloof@gmail.com (JIRA)

unread,
Apr 24, 2019, 10:30:31 AM4/24/19
to jenkinsc...@googlegroups.com
Nicolas De Loof assigned an issue to Unassigned
Change By: Nicolas De Loof
Assignee: Nicolas De Loof

chris.maes@macq.eu (JIRA)

unread,
May 10, 2019, 5:21:02 AM5/10/19
to jenkinsc...@googlegroups.com
Chris Maes commented on Bug JENKINS-53259
 
Re: Jenkins Pipeline build fails when trying to jenkins docker plugin

I also have this problem with:

  • jenkins 2.150.3
  • docker plugin 1.1.6
  • docker pipeline 1.17

chris.maes@macq.eu (JIRA)

unread,
May 10, 2019, 7:00:02 AM5/10/19
to jenkinsc...@googlegroups.com

I am trying to run the docker process on another server (not on Jenkins master); something like this:

node('master') { 
        withDockerServer([uri: 'tcp://docker-server:4243']) { 
                withDockerContainer([image: 'alpine']) { 
                        sh "pwd" 
                } 
        } 
}

this fails with the exact same error. Inspired by https://github.com/jenkinsci/docker/issues/626#issuecomment-358331311 I have to use this workaround:

  • add docker-server as a jenkins slave
  • mount the /home directory of my jenkins user inside the docker. My Jenkinsfile now looks like this:
node('docker-server') { 
        withDockerContainer([image: 'alpine', args: '-v /home/jenkins/:/home/jenkins']) { 
                sh "pwd; ls /usr/local/bin" 
        } 
}

it is just sad that I need to add the docker-server as a node...

chris.maes@macq.eu (JIRA)

unread,
May 10, 2019, 8:27:02 AM5/10/19
to jenkinsc...@googlegroups.com
Chris Maes edited a comment on Bug JENKINS-53259
I am trying to run the docker process on another server (not on Jenkins master); something like this:
{code:java}

node('master') {
       withDockerServer([uri: 'tcp://docker-server:4243']) {
               withDockerContainer([image: 'alpine']) {
                       sh "pwd"
               }
       }
}{code}

this fails with the exact same error. Inspired by [https://github.com/jenkinsci/docker/issues/626#issuecomment-358331311] I have to use this workaround:
* add docker-server as a jenkins slave
* mount the /home directory of my jenkins user inside the docker. My Jenkinsfile now looks like this:

{code:java}

node('docker-server') {
       withDockerContainer([image: 'alpine', args: '-v /home/jenkins/:/home/jenkins']) {
               sh "pwd; ls /usr/local/bin"
       }
}{code}

it is just sad that I need to add the docker-server as a node...


Another major drawback: this workaround does not work with declarative syntax: 
{code:java}
pipeline {
       agent { node { label 'docker-server' } }
       stages {
               stage('test run on docker') {
                       agent {
                               docker {
                                       image 'alpine'
                                       args '-v /home/jenkins:/home/jenkins'
                               }
                       }
                       steps {
                               sh "pwd"
                       }
               }
       }
}{code}
trouble is jenkins master tries to launch the docker agent himself now, and not on the *docker-server* node...

chris.maes@macq.eu (JIRA)

unread,
May 10, 2019, 8:34:02 AM5/10/19
to jenkinsc...@googlegroups.com
Chris Maes edited a comment on Bug JENKINS-53259
I am trying to run the docker process on another server (not on Jenkins master); something like this:
{code:java}
node('master') {
       withDockerServer([uri: 'tcp://docker-server:4243']) {
               withDockerContainer([image: 'alpine']) {
                       sh "pwd"
               }
       }
}{code}
this fails with the exact same error. Inspired by [https://github.com/jenkinsci/docker/issues/626#issuecomment-358331311] I have to use this workaround:
* add docker-server as a jenkins slave
* mount the /home directory of my jenkins user inside the docker. My Jenkinsfile now looks like this:

{code:java}
node('docker-server') {
       withDockerContainer([image: 'alpine', args: '-v /home/jenkins/:/home/jenkins']) {
               sh "pwd; ls /usr/local/bin"
       }
}{code}
it is just sad that I need to add the docker-server as a node...

Another major drawback * for scripted pipeline : this workaround does not work with declarative syntax: 

{code:java}
pipeline {
       agent
{ node { label 'docker-server' } }
any
       stages {
               stage('test run on docker') {
                       agent {
                               docker {


                     label 'docker-host'
                                       image 'alpine'
                                       args '-v /home/jenkins:/home/jenkins'
                               }
                       }
                       steps {
                               sh "pwd"
                       }
               }
       }
}{code}
trouble it is jenkins master tries just sad that I need to launch add the docker agent himself now, and not on the *docker -server * as a node...

pjdarton@gmail.com (JIRA)

unread,
Sep 24, 2019, 8:52:02 AM9/24/19
to jenkinsc...@googlegroups.com
pjdarton updated an issue
 
Change By: pjdarton
Component/s: docker-plugin
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

pjdarton@gmail.com (JIRA)

unread,
Sep 24, 2019, 8:53:01 AM9/24/19
to jenkinsc...@googlegroups.com
pjdarton commented on Bug JENKINS-53259
 
Re: Jenkins Pipeline build fails when trying to jenkins docker plugin

FYI pipeline code like withDockerServer means you're using the docker-workflow-plugin not the docker-plugin.  I've updated the "components" field accordingly.

Reply all
Reply to author
Forward
0 new messages