// Declarative // pipeline { agent none 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' } } } } // Script // node { /* Requires the Docker Pipeline plugin to be installed */ stage('Back-end') { docker.image('maven:3-alpine').inside { sh 'mvn --version' } } stage('Front-end') { docker.image('node:7-alpine').inside { sh 'node --version' } } } Using a Dockerfile For projects which require a more customized execution environment, Pipeline also supports building and running a container from a  Dockerfile  in the source repository. In contrast to the previous approach of using an "off-the-shelf" container, using the  agent { dockerfile true }  syntax will build a new image from a  Dockerfile  rather than pulling one from Docker Hub. Re-using an example from above, with a more custom  Dockerfile : 52