This commit is contained in:
dxin
2025-11-08 20:17:18 +08:00
parent 53090845cd
commit c487c80513
2 changed files with 12 additions and 7 deletions

View File

@@ -238,9 +238,11 @@ pipeline {
echo "发现 ${oldImages.size()} 个旧镜像需要清理"
oldImages.each { line ->
def imageTag = line.split(' ')[0]
echo "删除旧镜像: ${imageTag}"
sh(returnStatus: true, script: "docker rmi -f \"${imageTag}\" || true")
def parts = line.split(' ')
def imageId = parts[0]
def imageTag = parts[1]
echo "删除旧镜像: ${imageTag} (ID: ${imageId})"
sh "docker rmi -f \"${imageId}"\ || true"
}
echo ""