[JIRA] (JENKINS-60473) Docker pipeline: 'absolute path' error when running docker under windows

6 views
Skip to first unread message

pkruk@parasoft.com (JIRA)

unread,
Dec 13, 2019, 6:14:02 AM12/13/19
to jenkinsc...@googlegroups.com
Piotr Krukowiecki updated an issue
 
Jenkins / Bug JENKINS-60473
Docker pipeline: 'absolute path' error when running docker under windows
Change By: Piotr Krukowiecki
Summary: Docker pipeline: 'absolute path' error when running docker under windows
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

roberthecker@googlemail.com (JIRA)

unread,
Dec 18, 2019, 3:06:03 AM12/18/19
to jenkinsc...@googlegroups.com
Robert Hecker commented on Bug JENKINS-60473
 
Re: Docker pipeline: 'absolute path' error when running docker under windows

Hello Together,

i have the same problem when i try to execute the example from https://jenkins.io/doc/book/pipeline/docker/ on a Windows 10 Jenkins Master.

The Pipline i use is the one from the example: 

Jenkinsfile (Declarative Pipeline)pipeline {
    agent {
        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}

And the Error Message i get is following:

C:\Program Files (x86)\Jenkins\workspace\docker-jenkins-test_master>docker inspect -f . python:3.7-alpine 
.
[Pipeline] withDockerContainer
Jenkins does not seem to be running inside a container
$ docker run -d -t -w "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/" -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/" -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master@tmp/:C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master@tmp/" -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** python:3.7-alpine cmd.exe
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: Failed to run image 'python:3.7-alpine'. Error: docker: Error response from daemon: the working directory 'C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/' is invalid, it needs to be an absolute path.
See 'docker run --help'.
	at org.jenkinsci.plugins.docker.workflow.client.WindowsDockerClient.run(WindowsDockerClient.java:57)
	at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:199)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:286)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:179)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
	at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:126)
	at org.jenkinsci.plugins.docker.workflow.Docker.node(Docker.groovy:66)
	at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:114)
	at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.DockerPipelineScript.runImage(DockerPipelineScript.groovy:54)
	at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.AbstractDockerPipelineScript.configureRegistry(AbstractDockerPipelineScript.groovy:73)
	at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.AbstractDockerPipelineScript.run(AbstractDockerPipelineScript.groovy:52)
	at org.jenkinsci.plugins.pipeline.modeldefinition.agent.CheckoutScript.checkoutAndRun(CheckoutScript.groovy:61)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:84)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
	at sun.reflect.GeneratedMethodAccessor197.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:66)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Finished: FAILURE

roberthecker@googlemail.com (JIRA)

unread,
Dec 18, 2019, 3:27:03 AM12/18/19
to jenkinsc...@googlegroups.com
Robert Hecker edited a comment on Bug JENKINS-60473
Hello Together,

i have the same problem when i try to execute the example from [https://jenkins.io/doc/book/pipeline/docker/] on a Windows 10 Jenkins Master.

The Pipline i use is the one from the example: 
{code:java}

Jenkinsfile (Declarative Pipeline)pipeline {
    agent {
        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}
{code}

And the Error Message i get is following:
{code:java}
Finished: FAILURE{code}
When i look to the Error Message, it seems there are multiple problems inside:
# The Docker Container is a Linux Container, so the option "-w" should be a linux path pointing inside the container to a existing folder. (e.g.  {{/usr/src/app)}}
# The volume mount of the container is wrong. Jenkins tries to mount a host Windows path to a container Linux path, using for both paths the windows path style, which is not working. (Is Situation: -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/") (Should Situation example: -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:/docker-jenkins-test_master/")

roberthecker@googlemail.com (JIRA)

unread,
Dec 18, 2019, 3:27:04 AM12/18/19
to jenkinsc...@googlegroups.com
* When i look to the Error Message, it seems there are multiple problems inside: *
# The Docker Container is a Linux Container, so the option "-w" should be a linux path pointing inside the container to a existing folder. (e.g.  {{/usr/src/app)}}
# The volume mount of the container is wrong. Jenkins tries to mount a host Windows path to a container Linux path, using for both paths the windows path style, which is not working. (Is Situation: -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/") (Should Situation example: -v "C:/Program Files (x86)/Jenkins/workspace/docker-jenkins-test_master/:/docker-jenkins-test_master/")

mr.sonicblue@gmail.com (JIRA)

unread,
Dec 19, 2019, 2:04:03 PM12/19/19
to jenkinsc...@googlegroups.com

I've been trying to track this issue. It's a bit of a surprise because there was a big push recently to get Docker supported in version 1.21 of the plugin. The effort culminated in this pull request:

https://github.com/jenkinsci/docker-workflow-plugin/pull/184

I was racking my brain trying to figure out how this was so thoroughly tested, but this path issue exists. The best I can tell, anyone who successfully tested these changes was running Windows containers on a Windows host. In that scenario the paths would be valid for both the host and the container. The error reported here happens when you run Linux containers on a Windows host. An elegant fix for this would be challenging because the environment would need to be checked to see what type of containers Docker is currently configured to run.

Reply all
Reply to author
Forward
0 new messages