Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins windows docker fails to run image, working directory is invalid, it needs to be an absolute path

Tags:

docker

jenkins

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?

like image 968
JoelB Avatar asked May 14 '19 18:05

JoelB


People also ask

Does Jenkins work with Docker?

The Jenkins project provides Docker images for controllers, inbound agents, outbound agents, and more.

What is the use of Docker Plugin in Jenkins?

The aim of this docker plugin is to be able to use a Docker host to dynamically provision a docker container as a Jenkins agent node, let that run a single build, then tear-down that node, without the build process (or Jenkins job definition) requiring any awareness of docker.


1 Answers

At the moment, Jenkins Docker Pipeline plugin on the Windows host can't execute Linux Docker images due to a bug https://issues.jenkins.io/browse/JENKINS-60473

like image 139
Konstantin Pelepelin Avatar answered Sep 21 '22 05:09

Konstantin Pelepelin