-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Replace scale command with a scale option in the compose file #2496
Comments
👍 Completely agree with proposal. |
Sounds good! 👍 |
👍 |
2 similar comments
+1 |
+1 |
How abut having a minimum number of instances to scale in the docker-compose.yml and leave the scale command as it is, an override? That would seem to handle all the use cases people have proposed and what to do when the two different ways of scaling conflict. |
Why might you need scale command if you can just do |
It leaves the value in the docker-compose.yml as declarative there should be a minimum of 3, and if there should be a minimum of three the docker-compose scale 2 would be bad and stopping someone from doing that might be a good thing |
This proposal is about removing |
Context is that I disagree with removing scale, I like the fact that I can scale without having to first edit a file (sucks for automation) and that the command will not have unintended side-effects (me or someone else edits another part of the docker-compose and forgets about it) that could happen from a But I like the idea (need) of starting more than one of a thing from the |
|
What about a parameter to set/override arbitrary options declared or missing in the yml file? Given the following docker-compose.yml:
You could run Could be nice for automation as well, because you can override anything without using environment variables. |
Compose is stateless tool, option in yml file is intentionally suggested to avoid ambiguous behavior. |
What I was suggesting is still meant to be stateless. Calling I was trying to find a solution for arun-guptas concerns. I like the proposal, but it would remove the ability to scale services without having to edit a file. I guess you could work around this, but it makes automation unnecessarily cumbersome. On a second thought, you could always work around this limitation with environment variables. |
Without the scale command, I'm not sure how you're supposed to run a service that needs to be scaled dynamically. Just thinking off the top of my head, but maybe there needs to be some way of storing intermediate state which can dump out a new compose yaml file with the correct scale values? That way we can keep the scale command but don't have the ambiguity of dynamic data. |
Currently |
👍 |
1 similar comment
👍 |
I think the scale should be in docker-compose.yml since it is application configuration. However, I think it should be expanded so that it is a range like:
The above states that the application should start with 3 but can scale up to 10. That way the compose files specifies the allowed range and the command line specifies the current instance count. Whenever the container is brought up or restarted it would be set to the minimum configured. Anything set via command line is temporary and validated to be within that range. This makes sense since compose is a stateless tool so the previously set command line option would be lost on restart. This would allow for future enhancements with auto-scaling based upon load or other criteria. Using a min and max is how some PaaS providers scale like OpenShift: https://developers.openshift.com/managing-your-applications/scaling.html |
@steven-sheehy or… scale:
min: 3
max: 10 |
Coming over from the discussion on #1896, +1 for treating the contents of the compose file as a constraint on the scaling, rather than as the main interface for setting the current scaling level.
The default constraints would then be a minimum scale of 1, and no maximum scale. |
How about setting a default value, you can still override with scale:
min: 3
max: 10
default: 5 So mainly I want scale:
default: 5 Or written in short: scale: 5 I use
The problem here seems to be more a interpretation issue, and calling it |
Proposal is good. We at least need an option to initialize the number of instance per service. Please give us this. |
Scale in the yml file should be a default or initial value. If it's scale: 3, the 3 are started. If I use the command line option 6, then 6 is how many should be started. If the server reboots, the last number of containers would start. If I'm developing, I want to stop them all and docker-compose up, 3 as the yml says. |
Adding to my last proposal (above): While I included a Still a
Quoting the README:
|
^ the need for a |
Implemented in #4742 |
@shin- but this forces a scale? |
Also see the comment a year ago |
@luckydonald You can use |
@shin- Oh, great, thanks. |
Assuming |
IMO, it should retain the last scale, regardless of the scale value in the compose file. The compose file should indicate the starting number, but if you manually change scale, the assumption is you really mean to change scale until further change. |
I cant find an argument against an option.. imagen your deploy system repulling the whole project and rebuilding everything... now all scaling is lost, worst case the system overloads ... so why not add a minimum default in the docker-compose since there are a lot of worker scenarious that should have more than 1 from the simplest small scaled project there is |
+1 |
From #1661 (comment)
Having both a
scale
command andscale
configuration option leads to a scenario with unexpected results. Take this example:Given a
docker-compose.yml
that defines a serviceweb
withscale: 5
Run
docker-compose up -d
to start 5 instances of theweb
serviceThen run
docker-compose scale web=4
to down-scale the web service.Finally, run another
docker-compose up -d
.How many instances do you expect of
web
? Some might say4
because the service was scaled independently. Some might say5
because the compose file said 5.In the case where there are
4
instances, the value in the compose file is ignored, which is undesirable.up -d
should always bring services to the state described in the compose file.In the case where
up -d
scales to 5, there is no reason to have a scale command at all.up -d
is already handling scale. With the new file overrides a user could even set the scale numbers in ascale.yml
, and rundocker-compose -f docker-compose.yml -f scale.yml
, which supports keeping scale separate from application configuration.This proposal is to deprecate the
scale
command (add a removal warning for 1 or 2 releases, before finally removing it), and instead useup -d
to scale a service.Update
To handle the case of overriding the scale number from the command line,
up
can use theservice=count
syntax that is currently available to scale (#1661 (comment)).The text was updated successfully, but these errors were encountered: