Skip to content

add -f flag to prune commands for docker compat#1417

Open
knQzx wants to merge 1 commit intoapple:mainfrom
knQzx:prune-docker-compat-f-flag
Open

add -f flag to prune commands for docker compat#1417
knQzx wants to merge 1 commit intoapple:mainfrom
knQzx:prune-docker-compat-f-flag

Conversation

@knQzx
Copy link
Copy Markdown
Contributor

@knQzx knQzx commented Apr 14, 2026

summary

  • adds -f/--force to image/container/volume/network prune as a no-op
  • prints a warning to stderr when used, so the flag is not silently ignored
  • unblocks docker automation scripts calling prune -f

test plan

  • added CLI test: container prune -f succeeds, prints warning on stderr, normal output on stdout
  • did all four prune variants since docker scripts typically call each; happy to narrow to just image prune if preferred

fixes #938

@saehejkang
Copy link
Copy Markdown
Contributor

I don't think this is something we want here. Adding an option for a flag, to only just output it as a no-op is counter intuitive. However, I see the flag actually being useful, if it is properly implemented. This could be broken up into two separate issues:

  • Update any prune commands with the --all flag to ask the user if they are sure they want to continue (like docker)
  • Modifying this PR to bypass the prompt if the --force flag is used

What do you think?

@knQzx
Copy link
Copy Markdown
Contributor Author

knQzx commented Apr 19, 2026

I don't think this is something we want here. Adding an option for a flag, to only just output it as a no-op is counter intuitive. However, I see the flag actually being useful, if it is properly implemented. This could be broken up into two separate issues:

  • Update any prune commands with the --all flag to ask the user if they are sure they want to continue (like docker)
  • Modifying this PR to bypass the prompt if the --force flag is used

What do you think?

i went with option 2 because that's what @ptone asked for in #938 - no-op with a warning. the issue scope is just docker compat so i kept it narrow

no-op feels like a safer first step - it doesn't change behavior for anyone already using prune. prompt + -force is a separate, bigger change, but i can rework it if that's the preferred direction

@jglogan what do you think?

@JaewonHur JaewonHur requested a review from jglogan April 20, 2026 16:53
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.

[Request]: add a -f command to image prune for compatability

3 participants