compose: add --all flag to down for full cleanup#13685
compose: add --all flag to down for full cleanup#13685sarika-03 wants to merge 1 commit intodocker:mainfrom
Conversation
Signed-off-by: sarika-03 <sarikasharma9711@gmail.com>
|
using |
|
@ndeloof , Thanks for pointing that out. Using --profile="*" does allow including all profiles, but it’s not very discoverable and requires users to know this internal detail. The goal of --all is to provide a simple and consistent way to fully clean up a Compose project, similar to other Docker commands that expose an explicit --all flag (e.g., docker system prune --all). It avoids the need for users to reason about profiles when they just want a full reset of the project. |
glours
left a comment
There was a problem hiding this comment.
Thanks for the contribution! The underlying problem (inactive profiles surviving down) is real and worth solving.
However, we have concerns about the --all flag as proposed:
Naming ambiguity: --all in existing Compose commands (ps --all, ls --all) means "include containers/projects in states normally filtered out." This PR redefines it to mean "activate all profiles + force orphan removal" which is a different semantic. Users will reasonably expect down --all to also remove volumes and images, but it doesn't (you still need -v and --rmi). This will lead to confusion: "I used --all but my volumes are still there."
--profile=* already works: As @ndeloof pointed out, docker compose --profile=* down -v --remove-orphans already achieves the same result today. The gap is discoverability, not functionality.
Hidden side-effects: --all silently forces --remove-orphans even if the user didn't ask for it. These should remain orthogonal flags the user composes explicitly.
Suggestions:
- Preferred: Improve discoverability of
--profile=*by adding examples todown --help(e.g.,docker compose --profile='*' down -v --remove-orphansfor full cleanup) - If a dedicated flag is needed: Consider
--all-profiles, it says exactly what it does, stays orthogonal to-v/--rmi/--remove-orphans, and avoids the naming collision with existing--allsemantics
|
@glours Thanks for the detailed feedback this makes a lot of sense. I agree that overloading Also agreed that Based on your suggestion, I can update the PR to:
Let me know if this direction aligns better with the intended design. |
|
@sarika-03, as I said, I’d prefer that we improve discoverability first. We already have everything in place, we just need to make it more explicit to users. It’s a low-cost change and something we should be able to merge quickly. We’ll still need to discuss with @ndeloof the pros and cons of adding a new flag to the command, so I’d rather not have you spend time on something that may ultimately not be merged, for now. |
What I did
Added a new
--allflag todocker compose downso users can fully clean up a Compose project, including resources created under inactive profiles.Changes included
--alltodocker compose downdown --allload the project with all profiles enableddown --allinclude orphan containers automaticallydowncommand help and docsManual verification
bar)docker compose down -v -t 0 --remove-orphansleft the profiled container, network, and volume behinddocker compose down --all -v -t 0removed all remaining project resourcesRelated issue
Fixes #13647
Related to #13027
Cute animal 🐳