0

is there a way to port the following docker compose configuration from ecs console?

deploy:
  update_config:
    parallelism: 2
    delay: 10s
    order: stop-first

i'm interested in forcing the order option, one of the container in the ecs task must be stopped before creating a new one during the rolling updates

fusillator
  • 47
  • 6

1 Answers1

4

If one of the containers in the task must be stopped before another instance can be created, then in ECS the entire task will have to be stopped before another instance of the task is created.

In ECS you would control this via the DeploymentConfiguration options on the ECS service. You would need to set the maximumPercent and minimumHealthyPercent values such that you never get more than your intended number of tasks at any time.

For example if you want a maximum of 2 instances of the task to be running, you would set the desired task count to 2 in the service's auto-scaling configuration, and set maximumPercent to 100 and minimumHealthyPercent to 50.

Mark B
  • 183,023
  • 24
  • 297
  • 295
  • cool it works with a desired task count of 1 and maximumPercent 100 and mimimumHealthy percent to 0 (not a production case just playing to study the cloud). but it's a workaround right? It sacrifies the availabilty of the service to force a constraint and also I'm not sure it will ensure the correct order if you have more tasks (for example using 4 and 100% aws could be stop the first one and force the parallelism for the others) Is there a way to force the new deployment on a different vm/server when maximumPercent is upper than 100? – fusillator Oct 28 '22 at 09:18
  • I think you are confusing containers and tasks. A Task is multiple containers (all the containers in the task definition). In an ECS deployment the entire task (all the containers in it) are stopped and replaced with an entirely new task. – Mark B Oct 28 '22 at 12:52
  • I wouldn't call it a workaround, I would call it a limitation of your software that you can only have one instance of a container running at a time. You would need to fix that so you can have more than one running at a time if you care about minimizing down-time. – Mark B Oct 28 '22 at 12:53