pipeline { agent any options { buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) } stages { stage('Clean docker images agent1') { agent { label 'agent1' } steps { sh 'docker system prune -a -f' sh 'docker network prune -f' } } stage('Clean docker images agent2') { agent { label 'agent2' } steps { sh 'docker system prune -a -f' sh 'docker network prune -f' } } } }