-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add --prune
for up command
#12642
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
Add --prune
for up command
#12642
Conversation
Signed-off-by: Remco Kranenburg <remco.kranenburg@crunchr.com>
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.
@ndeloof what do you think, shouldn't we use WatchOptions
directly here? I don't have a strong option
Watch: upOptions.watch, | ||
Prune: upOptions.prune, |
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 wonder if we should not pass directly WatchOptions
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.
we should just drop the api
package and get CLI options used by composeService
@@ -170,6 +171,7 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *c | |||
flags.BoolVar(&up.wait, "wait", false, "Wait for services to be running|healthy. Implies detached mode.") | |||
flags.IntVar(&up.waitTimeout, "wait-timeout", 0, "Maximum duration in seconds to wait for the project to be running|healthy") | |||
flags.BoolVarP(&up.watch, "watch", "w", false, "Watch source code and rebuild/refresh containers when files are updated.") | |||
flags.BoolVar(&up.prune, "prune", false, "Prune dangling images on rebuild") |
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 wonder: is there any benefits not pruning those ? Shall we just make this the default ? Then do we need a flag ?
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.
Yep, I agree
@remcokranenburg do you mind adapting your PR to prune by default? We just need to keep it for the watch
command itself to let users who want it to choose the option of keeping dangling images
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.
Sure! Would you also like to prune by default for the watch
command? That might be more consistent, thus less surprising.
By keeping the flag, it should be possible to disable in either up
or watch
with --prune=0
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.
up already has so much flags we'd prefer not to have more. For those who really want to keep dangling images (?) watch --prune=false
could be a reasonable workaround
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.
Yes I'm aligned with @ndeloof on this one, just keep the --prune
flag for the watch
command
BTW thank you for doing it 🙏
you have to run |
Note: this PR is reopened unchanged from one that was closed due to inactivity.
What I did
Just like #11932, which added
watch --prune
, but now for the up command.Related issue
#11073
(not mandatory) A picture of a cute animal, if possible in relation to what you did
