检查docker镜像是否存在
import hudson.model.*;
def call(String imageName) {
result = sh(script: "docker image ls '${imageName}:latest' |wc -l", returnStdout: true).trim()
//int sokore = sh """docker image ls '${imageName}' |wc -l"""
if ("${result}" == "2") {
println "镜像:${imageName}:latest存在。"
return true
} else {
println "镜像:${imageName}:latest不存在。"
return false
}
}

浙公网安备 33010602011771号