AWS ECR 建議配置
Lifecycle policy設置
保留最新30天
{
"rules": [
{
"rulePriority": 1,
"description": "Keep last 30 images",
"selection": {
"tagStatus": "any",
"countType": "imageCountMoreThan",
"countNumber": 30
},
"action": {
"type": "expire"
}
}
]
}
保留最新30天,以及另外設置特定tag 永久保留。
{
"rules": [
{
"rulePriority": 1,
"description": "Keep 'base' tag forever",
"selection": {
"tagStatus": "tagged",
"tagPrefixList": ["base"],
"countType": "imageCountMoreThan",
"countNumber": 9999
},
"action": {
"type": "expire"
}
},
{
"rulePriority": 2,
"description": "Keep last 30 images (excluding base tag)",
"selection": {
"tagStatus": "any",
"countType": "imageCountMoreThan",
"countNumber": 30
},
"action": {
"type": "expire"
}
}
]
}