首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AWS ECS与CodePipeline的连续部署问题

AWS ECS与CodePipeline的连续部署问题
EN

Stack Overflow用户
提问于 2019-05-21 20:44:34
回答 1查看 142关注 0票数 0

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

"buildspec.yml"文件中,docker正在推送两个图像,一个带有"latest“标签,另一个带有如下所示的commit id标签

代码语言:javascript
复制
 - 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标签的图片呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56238607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档