While deploying ECS using codepipeline like specified in aws official document, two docker image is pushing into ECR. One image contain both Commit id and latest tag and other image is untagged like specified below image.
In "buildspec.yml"
file i can see, docker is pushing two image one with "latest tag and other one with commit id tag like given below
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
My question is
1) In ECR there must be two image one with "commit id"
tag and other one with "latest" tag after the docker push complete. But in ECR, it is showing with wrong tag name, please check the above attached image.Why one image is showing with untagged ?
2) Why i need to push two image with commit id and latest tag, when my task definition is using only latest tag to build the container. Didn't i have to push only docker image with "latest" tag , why i need to push image with commit id tag ?