I am using the below podTemplate in my jenkinsfile/pipeline:
podTemplate(label: 'builder',
imagePullSecrets: [ 'mypull-secret' ],
containers: [
containerTemplate(name: 'jnlp', image: 'jenkins/inbound-agent:4.9-1', args: '${computer.jnlpmac} ${computer.name}'),
containerTemplate(name: 'gradle', image: 'gradle:latest', command: 'cat', ttyEnabled: true),
containerTemplate(name: 'sample-image', image: 'internalreg/samples/sample-image:latest', command: 'cat', ttyEnabled: true)
],
volumes: [
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')
]) {
node('builder') {
stage('Checkout') {
checkout scm
}
stage('Gradle') {
container('gradle') {
sh "./gradlew --version"
}
}
stage('Sample image') {
container('sample-image') {
sh "ls -la"
}
}
}
}
But when I run the above in jenkins it just hangs at the Sample image stage.
[Pipeline] { (Sample image) (hide)
[Pipeline] container
[Pipeline] {
[Pipeline] sh
How do I configure a containerTemplate for my own custom docker container?