I'm having issues trying to build a Docker image with the Docker Pipeline plugin.
I've tried searching, but no-one seems to be having the issue, and all the documentation I see suggests I'm not doing anything stupid.
My current Jenkins file is as follows (I've pared it back for simplicity/debugging):
----
#!groovy
node {
stage 'checkout'
checkout scm
stage 'build'
def image = docker.build('openshift/wildfly:10')
}
----
The output from the job is:
----
Started by user Lyle Dietz
Cloning the remote Git repository
> git init /home/jenkins/.jenkins/workspace/wildfly@script # timeout=10
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username jenkins # timeout=10
> git config --local credential.helper store --file=/tmp/git2241825672262408901.credentials # timeout=10
> git config --local --remove-section credential # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username jenkins # timeout=10
> git config --local credential.helper store --file=/tmp/git4715501803936103145.credentials # timeout=10
> git config --local --remove-section credential # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 4e21d6895f1505810a35774f7ee6e339658c8252 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 4e21d6895f1505810a35774f7ee6e339658c8252
> git rev-list 4e21d6895f1505810a35774f7ee6e339658c8252 # timeout=10
[Pipeline] node
Running on master in /home/jenkins/.jenkins/workspace/wildfly
[Pipeline] {
[Pipeline] stage (checkout)
Entering stage checkout
Proceeding
[Pipeline] checkout
Cloning the remote Git repository
> git init /home/jenkins/.jenkins/workspace/wildfly # timeout=10
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username jenkins # timeout=10
> git config --local credential.helper store --file=/tmp/git5568879933463267023.credentials # timeout=10
> git config --local --remove-section credential # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username jenkins # timeout=10
> git config --local credential.helper store --file=/tmp/git695409405329882652.credentials # timeout=10
> git config --local --remove-section credential # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 4e21d6895f1505810a35774f7ee6e339658c8252 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 4e21d6895f1505810a35774f7ee6e339658c8252
[Pipeline] stage (build)
Entering stage build
Proceeding
[Pipeline] node
Running on master in /home/jenkins/.jenkins/workspace/wildfly@2
[Pipeline] {
[Pipeline] sh
[wildfly@2] Running shell script
+ docker build -t openshift/wildfly:10 .
time="2016-06-08T14:53:04+10:00" level=fatal msg="Cannot locate Dockerfile: Dockerfile"
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
----
and after the build fails the workspace directory looks thusly:
----
# tree workspace/
workspace/
├── wildfly
│ ├── Dockerfile
│ └── Jenkinsfile
├── wildfly@2
├── wildfly@2@tmp
└── wildfly@script
├── Dockerfile
└── Jenkinsfile
4 directories, 4 files
----
I don't understand why the directories with '@' are being created. Shouldn't this be running in the workspace? If not, how do I get my code checked out in to the directory that the docker build will run in?
Now matter how I try to do this, the docker build step _always_ creates a new directory.
I'd appreciate any help with this, I'm starting to feel rather stupid :( .