Docker Pipeline Step

33 views
Skip to first unread message

pe...@cyrusbio.com

unread,
Feb 24, 2017, 1:59:10 AM2/24/17
to Jenkins Users
I might just be missing something here.. But it seems like the docker pipeline stuff is pretty busted.

docker.build does *not* seem to return a docker image, even if the build was successful. Nor does docker.image("image id") return a usable image object. I'm rewriting these two functions in a shared groovy library with sh calls rn. Am I crazy? Are other people seeing this? What am I doing wrong?

Thanks,
-Peter

Cyrille Le Clerc

unread,
Feb 24, 2017, 12:15:01 PM2/24/17
to Jenkins Users
Hello Peter,


You can use docker.build(...).inside{...} and docker.image("my-image").inside {...}

The sample below should do what you want.

node {
  git '…' // checks out Dockerfile & Makefile
  def myEnv = docker.build 'my-environment:snapshot'
  myEnv.inside {
    sh 'make test'
  }
}
Cyrille
Reply all
Reply to author
Forward
0 new messages