Complete the code to create an Amazon ECR repository named 'my-repo'.
aws ecr create-repository --repository-name [1]The command creates an ECR repository with the specified name. Here, 'my-repo' is the correct repository name.
Complete the command to authenticate Docker to your Amazon ECR registry.
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin [1].dkr.ecr.us-east-1.amazonaws.com
The AWS account ID is required to form the full ECR registry URI. '123456789012' is the example account ID here.
Fix the error in the command to tag a Docker image before pushing it to ECR.
docker tag my-image:latest [1].dkr.ecr.us-east-1.amazonaws.com/my-repo:latest
The tag must include the AWS account ID to specify the full ECR repository URI.
Fill both blanks to push a Docker image to the ECR repository.
docker push [1].dkr.ecr.us-east-1.amazonaws.com/[2]:latest
The first blank is the AWS account ID for the registry URI. The second blank is the repository name where the image is pushed.
Fill all three blanks to create a lifecycle policy JSON that expires images older than 30 days.
{
"rules": [
{
"rulePriority": [1],
"description": "Expire images older than 30 days",
"selection": {
"tagStatus": "[2]",
"countType": "[3]",
"countUnit": "days",
"countNumber": 30
},
"action": {
"type": "expire"
}
}
]
}The rulePriority is 1 for the first rule. The tagStatus is 'tagged' to select tagged images. The countType 'sinceImagePushed' means counting days since the image was pushed.