简体   繁体   English

具有相同任务但不同docker镜像的ECS更新服务

[英]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?我假设当图像发生变化时,服务会运行已经注册的任务,这些任务应该正确地提取图像吗?

Example of commands I run我运行的命令示例

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.

相关问题 AWS ECS 使用相同的任务定义和图像重新启动服务,无需停机 - AWS ECS restart Service with the same task definition and image with no downtime 如何将更新的 Docker 图像部署到 Amazon ECS 任务? - How do I deploy updated Docker images to Amazon ECS tasks? ECS FARGATE 任务定义与 docker 中心图像 - ECS FARGATE TASK definition with docker hub image Docker 图片适用于 docker-compose up 但不适用于 Amazon ECS 或 Heroku - Docker Image works with docker-compose up but not on Amazon ECS or Heroku ECS - 容器无法从 Docker Hub 拉取公共镜像 - ECS - Container cannot pull public image from Docker Hub ASP.NET Docker 图像在 AWS ECS 中立即退出 - ASP.NET Docker image exits immediately in AWS ECS 如何将 Docker 映像从 GitLab CI 注册表部署到 Amazon ECS? - How to deploy a Docker image from GitLab CI registry to Amazon ECS? 使用 aws cli 如何获取每个 ecs 服务的任务 ID 列表 - using aws cli how to get list of tasks id per ecs service 是否可以确保我的三个 docker 实例在 ECS 的不同 EC2 上运行? - Is it possible to make sure three of my docker instances run on different EC2 of ECS? 我应该通过 CloudFormation 还是直接通过 ecs 更新 ecs 服务 - Should I update ecs service through CloudFormation or ecs directly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM