Jenkins windows docker fails to run image, working

2020-03-18 02:28发布

I have an installation of Jenkins on my windows 10 machine and I'm trying to run the basic node.js pipeline example. When Jenkins tried to run the image I listed in the Jenkinsfile, I get this error:

Failed to run image 'node:7-alpine'. Error: docker: Error response from daemon: the working directory 'C:\Users\Joel\.jenkins\workspace\symview-3_master' is invalid, it needs to be an absolute path.

See 'docker run --help'.

This is the Jenkinsfile I am using:

pipeline {
     agent {
        docker { image 'node:7-alpine' }
    }

    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }
}

How can I fix the absolute path issue on windows?

1条回答
三岁会撩人
2楼-- · 2020-03-18 02:38

Try replacing the working directory path as below (escape each slash with ) C:\\Users\\Joel\\.jenkins\\workspace\\symview-3_master

查看更多
登录 后发表回答