How to use the Jenkins docker plugin for containers that persist between stages -
below except jenkins build pipeline script spin container , allow number of actions performed inside container. question this, syntax using docker plugin create container in 1 build stage still can used in subsequent build stages.
docker.image('groovy:2.4').inside { sh 'groovy -v' // if have file called test.groovy in jenkins workspace, can "magically" access // inside container sh 'groovy test.groovy' }
the inside
command causes container exit when body finishes. keep container running use following syntax:
docker.image('image-name').run { ... }
this keep container running later stages.
Comments
Post a Comment