步骤1:确保CodeBuild Service Role被授权为ECR仓库管理员
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "CodeBuildAccess",
"Effect": "Allow",
"Action": [
"ecr:*"
],
"Resource": "*"
}
]
}
步骤2:检查Image URI是否正确
- name: Build Docker Image
command:
- "docker"
- "build"
- "-t"
- ":latest"
- "."
步骤3:检查IAM Role是否具有对S3和ECR的访问权限
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:*"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "*"
}
]
}
步骤4:检查Image的大小是否超过了ECS Task的限制
"containerDefinitions": [
{
"name": "web",
"image": "",
"cpu": 128,
"memory": 256,
"essential": true
}
],
"memory": "512",
"taskRoleArn": ""