[英]ECS updating service with same tasks but different docker image
I am an issue that either I do not understand well or something weird happening with aws ecs service.我是一个问题,要么我不太了解,要么 aws ecs 服务发生了一些奇怪的事情。
I update my code, create a new docker image and push it to be deployed using ECS.我更新了我的代码,创建了一个新的 docker 镜像并将其推送到使用 ECS 进行部署。 The issue is, when the task definition does not changes, the code does not get deployed, even though the image in ECR got updated.
问题是,当任务定义未更改时,即使 ECR 中的映像已更新,代码也不会部署。 How can get my code deployed then?
那么如何部署我的代码呢? I am assuming that when the image has changed, the services is run the already registered tasks which should pull the image right?
我假设当图像发生变化时,服务会运行已经注册的任务,这些任务应该正确地提取图像吗?
aws ecs register-task-definition --cli-input-json file:///deploy/tasks/my-task-definition.json
aws ecs update-service --service my-service --cluster my-clusdter --task-definition my-task-defintion
The first time I run these commands, the code is deployed, if I update my code, push the new image to the Registry, then run these commands, my code does not get deployed.我第一次运行这些命令时,代码被部署,如果我更新我的代码,将新图像推送到注册表,然后运行这些命令,我的代码不会被部署。
The updates are pulled every time your ECR gets updated.每次更新 ECR 时都会提取更新。 Double check the way you're confirming the updated version.
仔细检查您确认更新版本的方式。
In order to update your container with the updated images, you have to revised your task definition with the latest image from the repository, then your service should be updated with the new task definition you've defined.为了使用更新的图像更新您的容器,您必须使用存储库中的最新图像修改您的任务定义,然后您的服务应该使用您定义的新任务定义进行更新。
It looks like you are on the right track, but I assume that json file is revising your task definition with the same image.看起来你在正确的轨道上,但我假设 json 文件正在使用相同的图像修改你的任务定义。 If this is the case, you can just change the tag for the image to:latest so that you can run the same commands with the same json every single time.
如果是这种情况,您只需将图像的标签更改为:最新,这样您就可以每次都使用相同的 json 运行相同的命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.