在运行我的Jenkinsfile之前,我想删除/停止所有在EC2实例(附加了我的jenkinsfile)中运行的容器,该怎么做?
node {
def app
stage('Clone repository') {
/* Cloning the Repository to our Workspace */
checkout scm
}
stage('Build image') {
/* This builds the actual image */
app = docker.build("mendel/nodeapp7")
}
stage('run image') {
/* This builds the actual image */
app.run("--name pngimage_build_${env.BUILD_NUMBER} -i -t -p 80:80")
}
stage('Test image') {
app.inside {
echo "Tests passed"
}
}
}