在使用aws official document中指定的代码管道部署ECS时,两个docker映像正在推送到ECR中。一个图像既包含提交id又包含最新标记,另一个图像未标记,如下图所示。

在"buildspec.yml"文件中,docker正在推送两个图像,一个带有"latest“标签,另一个带有如下所示的commit id标签
- 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我的问题是
1)在对接推送完成后,ECR中必须有两个镜像,一个带最新标签,另一个带"commit id"标签。但是在ECR中,它是用错误的标签名称显示的,请检查上面附加的image.Why one图像是用未标记的吗?
2)当我的任务定义是只使用最新的标签来构建容器时,为什么我需要推送两个带有commit id和latest标签的镜像。难道我不需要推送带有“最新”标签的docker图片吗?为什么我需要推送带有提交id标签的图片呢?
发布于 2019-06-06 15:34:39
回答我自己的帖子,希望有人能找到有用的信息:
1)在ECR中,根据aws文档,在docker推送完成后,必须有两个镜像,一个带有"commit id“标签,另一个带有"latest”标签。但是在ECR中,它显示了错误的标签名称,请检查附件中的图像。为什么有一张图片显示未加标签?
The reason why there is a untagged image is because when an existing image with a tag latest already exists its tag will be removed when a new image called latest is pushed to ECR, only one image will result from the 2 docker push commands, this is because they are tagged together. This helps when reviewing which latest image is in use by looking at the commit hash.
2)当我的任务定义是只使用最新的标签来构建容器时,为什么我需要推送两个带有commit id和latest标签的镜像。难道我不需要推送带有“最新”标签的docker图片吗?为什么我需要推送带有提交id标签的图片呢?
Pushing the second image adds the commit hash as a tag. Overtime as more images are added to the ECR repository it helps to have the commit hash as a tag to differentiate between previous latest images especially if a particular image is needed for a rollback.
https://stackoverflow.com/questions/56238607
复制相似问题