Hi
I want to be able to use a pipeline, and as my first step specify a docker
image and then have the rest of the job run in a container spun up based on
that image. Ideally I would like to use this on a farm of hosts, but at a start
at least localhost.
This is how I have set it up.
I have the docker plugin, and have configured a cloud on a remote machine, and
the test button reports back a version, so my basic connectivity is there (i.e.
remote access is correctly configured).
I have specified a template, which I can confirm is present on the remote
dockerhost with "docker image ls". It is built with "FROM jenkins/ssh-slave"
and then a few apt-get lines.
I have choosen connectwith ssh and inject ssh key and the "jenkins" user (which
has credentials in Jenkins already).
I have choosen pull strategy "never pull" so it will use the image I have at
hand.
I have created a test job, pipetest, with a pipeline looking like this:
pipeline {
agent {
docker {
image "slavetest:latest"
}
}
stages {
stage('Build') {
steps {
git '<myrepo'
sh "go get ./..."
sh "go build ."
}
}
}
}
When I initiate a build I get this output:
Started by user Andreas Davour<http://10.238.92.69/user/alvada>
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins<http://10.238.92.69/computer/(master)/> in
/var/jenkins_home/jobs/pipetest/workspace
[Pipeline] {
[Pipeline] sh
+ docker inspect -f . slavetest:latest
/var/jenkins_home/jobs/pipetest/workspace@tmp/durable-db817775/script.sh: 1:
/var/jenkins_home/jobs/pipetest/workspace@tmp/durable-db817775/script.sh:
docker: not found
[Pipeline] sh
+ docker pull slavetest:latest
/var/jenkins_home/jobs/pipetest/workspace@tmp/durable-ff2f7ee1/script.sh: 1:
/var/jenkins_home/jobs/pipetest/workspace@tmp/durable-ff2f7ee1/script.sh:
docker: not found
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE
I can now see a dead container on my remote host, so the connectivity worked,
but it did not run the commands I had in my stage. It looks like it's trying to
run the "docker" command within the remote container, not my build commands. I
expected it to run "git" and "sh" and fail.
I am missing something obvious about how to set this up, but what?
***************************************************************
Consider the environment before printing this message.
To read the Company's Information and Confidentiality Notice, follow this link:
http://www.veoneer.com/en/important-information-and-confidentiality-notice
***************************************************************
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/AM0PR04MB632445D184C44045E33E9F95BD570%40AM0PR04MB6324.eurprd04.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.