-
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
docker-compose up --scale, scale in config file #4742
Conversation
…rmat docker-compose scale modified to reuse code between up and scale Signed-off-by: Joffrey F <[email protected]>
Signed-off-by: Joffrey F <[email protected]>
d3cef10
to
b325579
Compare
Signed-off-by: Joffrey F <[email protected]>
raise UserError( | ||
'The scale command is incompatible with the v2.2 format. ' | ||
'Use the up command with the --scale flag instead.' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we relax this restriction and only error if the config file contains scale:
fields in the config?
I think that will remove the need to store config_version
on the project as well.
@@ -875,7 +874,7 @@ def up(self, options): | |||
If you want to force Compose to stop and recreate all containers, use the | |||
`--force-recreate` flag. | |||
|
|||
Usage: up [options] [SERVICE...] | |||
Usage: up [options] [--scale SERVICE=NUM...] [SERVICE...] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would just be part of options
like the other options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have to declare it separately because it's repeatable. Same goes for build for example:
Usage: build [options] [--build-arg key=val...] [SERVICE...]
or run:
Usage: run [options] [-v VOLUME...] [-p PORT...] [-e KEY=VAL...] SERVICE [COMMAND] [ARGS...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, cool, I didn't know that.
Signed-off-by: Joffrey F <[email protected]>
Implements #2496
This is a slight variant of Daniel's proposal in #2496. It adds a
--scale
flag instead of overloading the functionality of the services list, which works around the issue described in #1661 (comment)The
--scale
option will be available for all versions of the Compose file, but thescale
config option will only be added in file format 2.2. As a result,docker-compose scale
with a 2.2 config file will be prohibited.deploy.replicas
might be considered as synonym toscale
in the v3 format, but would be an independent addition (i.e. not in this PR).