I have several jenkins slaves configured and only label with dockerserver
has docker env, then how can I restrict the jenkins pipeline docker agent in this slave?
Below Jenkinsfile
doesn't work, the agent
inside stage
will overwrite the defined slave dockerserver
pipeline { agent { label 'dockerserver' } stages { stage('Back-end') { agent { docker { image 'maven:3-alpine' } } steps { sh 'mvn --version' } } stage('Front-end') { agent { docker { image 'node:7-alpine' } } steps { sh 'node --version' } } } }
It may pick other slave which doesn't have docker supported
Any suggestion?