Repository navigation
fix(down): keep volumes other services use on down -v with services - #14449
Merged
glours merged 1 commit intoNov 13, 2026
Merged
Conversation
Contributor
|
Thanks, this fixes the reported case and the approach looks right. Two non-blocking follow-ups:
|
ndeloof
previously approved these changes
Nov 4, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
htoyoda18
force-pushed
the
fix/down-volumes-of-selected-services
branch
from
November 5, 2026 23:35
3cb13eb to
15e6847
Compare
Contributor
Author
|
@ndeloof I rebased onto |
3 tasks
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
docker compose down -v <service>no longer removes the volumes of services it does not tear down. Before, it also tried to remove the volumes of the selected services' dependencies, and of services outside the selection that share a volume. Only the engine's "in use" check kept them, so once the dependency's container was gone (for example after a plaindown),down -v webdeleted the data volume of thedbthatwebdepends on.Related issue
Fixes #14448
Changes made
pkg/compose/down.go:downrecords the services it tears down: the selected ones and those that depend on them.ensureVolumesDownskips any volume that another service uses, including the services the selection disabled. It reusesvolumeConsumersfromreconcile.go, which also followsvolumes_from.down -vis unchanged.pkg/compose/down_test.go: addsTestEnsureVolumesDown_KeepsVolumesOfOtherServices, and updates the existing callers for the new parameter.pkg/e2e/volumes_test.goandtestdata/TestDownVolumesOfSelectedServices/compose.yaml: adds the scenarioTestDownVolumesOfSelectedServices. Afterupanddown,down -v webremoves onlyweb's own volume. It keeps the dependency's volume and the onewebshares with an unrelated service.Testing done
make testmake e2e-composeormake e2e-compose-standalonemake lintmake fmtAI tool used (if applicable)
AI Tool:
Additional context
(not mandatory) A picture of a cute animal, if possible in relation to what you did