I am currently running Jenkins 2.89.3
with Docker 17.12.0-ce-win47
on Windows 10, with Linux containers.
I am trying to run the following Jenkins file
pipeline {
agent { docker 'maven:3.3.3' }
stages {
stage('build') {
steps {
sh 'mvn --version'
}
}
}
}
However, I'm getting the following error in Jenkins:
java.io.IOException: Failed to run image 'maven:3.3.3'. Error: docker:
Error response from daemon: the working directory
'C:\Users\c.c\.jenkins\workspace\Neo4jTime_master-R4QSBCTASBURK2MQKHAPXGLIBNT65CJORPZCYLPCGRG75IGOQKTA'
is invalid, it needs to be an absolute path.
What should I do?
I had a similar problem when I was trying to install Jenkins on Windows. Example solution it to Run Jenkins in Docker with Docker inside.
I prepared small README how to set up Jenkins in Docker with Docker inside and with an example Jenkinsfile https://github.com/auriuki/jenkins-docker
In short: run Jenkins in Docker like it is in the official Jenkins documentation.
docker run ^
-u root ^
--rm ^
-d ^
-p 8080:8080 ^
-p 50000:50000 ^
-v "E:/Docker/Jenkins":/var/jenkins_home ^
-v /var/run/docker.sock:/var/run/docker.sock ^
--name jenkins ^
jenkinsci/blueocean
where E:/Docker/Jenkins
is a created directory for jenkins configuration, workspec, etc. - to avoid loosing data after container is removed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With