Skip to content

sort containers by creation date to scale down the older ones#10571

Merged
milas merged 1 commit intodocker:v2from
ndeloof:sort_scale_down
May 23, 2023
Merged

sort containers by creation date to scale down the older ones#10571
milas merged 1 commit intodocker:v2from
ndeloof:sort_scale_down

Conversation

@ndeloof
Copy link
Copy Markdown
Contributor

@ndeloof ndeloof commented May 16, 2023

What I did
sort service containers by creation date, so that scaling down will remove the older ones. This makes "down scale" more deterministic.

This allows to better support no-downtime container replacement by running:

docker compose up --scale x=2 --no-recreate -d  # creates a 2nd container for service, maybe with up-to-date image
docker compose up --scale x=1 --no-recreate -d  # remove older container

Related issue
fixes #10569

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (00f72cb) 59.49% compared to head (8a914bc) 59.49%.

Additional details and impacted files
@@           Coverage Diff           @@
##               v2   #10571   +/-   ##
=======================================
  Coverage   59.49%   59.49%           
=======================================
  Files         107      107           
  Lines        9356     9359    +3     
=======================================
+ Hits         5566     5568    +2     
  Misses       3214     3214           
- Partials      576      577    +1     
Impacted Files Coverage Δ
pkg/compose/convergence.go 69.29% <0.00%> (-0.38%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ndeloof ndeloof requested review from a team, StefanScherer, glours, laurazard, milas, nicksieger and ulyssessouza and removed request for a team May 16, 2023 09:48
@milas milas merged commit 68c462e into docker:v2 May 23, 2023
@ndeloof ndeloof deleted the sort_scale_down branch July 3, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] --scale numbering does not start at _2 even when original container name has _1

2 participants