Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

335
Views
Jenkins - How to run - docker system prune - in the pipeline

This is my Jenkinsfile for building docker image and pushing it to dockerhub. Everything works just great. I would like to clean up the untagged images after the build process. Currently I do docker system prune -f manually on the Jenkins node. Is there anyway to incorporate when agent is none?

pipeline {
    agent none  
    stages {
        stage('Build Jar') {
            agent {
                docker {
                    image 'maven:3.6.0'
                    args '-v $HOME/.m2:/root/.m2'
                }
            }
            steps {
                sh 'mvn clean package'
            }
        }
        stage('Build Image') {
            steps {
                script {
                    app = docker.build("myimagename")
                }
            }
        }
        stage('Push Image') {
            steps {
                script {
                    app.push("latest")
                }
            }
        }
    }
}
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!