Skip to content

Stop and remove project containers in compose down - #192

Open
Mcrich23 wants to merge 2 commits into
mainfrom
t3/compose-down-support
Open

Mcrich23 wants to merge 2 commits into
mainfrom
t3/compose-down-support

Conversation

@Mcrich23

@Mcrich23 Mcrich23 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

down stops and removes selected containers in reverse dependency order through Container 1.7.1 native APIs. It decodes and validates stop_signal, passes it to native stop options, and applies stop_grace_period or --timeout. Stop and delete failures propagate; failed stops leave the container and extra_hosts bind source intact.

up now creates project-scoped networks, including the implicit default network, and stamps newly created networks and volumes with management and project labels. Creation, attachment, and teardown share name resolution, including explicit and legacy external names. Null named-volume definitions and destination-only anonymous volumes are created through the native API.

down removes owned networks. -v/--volumes also removes owned named and anonymous volumes. Cleanup preserves external resources, Apple’s built-in default network, resources attached to surviving containers, and resources without proven ownership. Legacy resources are diagnosed and preserved. No bind directories are deleted, and no prune or shell fallback is used for teardown or resource creation. Lookup and deletion failures propagate rather than being treated as absence.

--remove-orphans requires matching project labels and a service absent from the complete Compose file. Configured inactive services remain protected. Profile selection follows the documented Compose rules.

Validation: 12 focused static tests and all 5 native ComposeDownTests passed. Runtime coverage includes signal delivery and timeout, reverse dependency order, ownership and legacy preservation, external-volume preservation, anonymous-volume deletion, and resources retained for an inactive surviving service under --remove-orphans --volumes. A final focused rerun passed and verified the explicit anonymous-volume assertion and both volume flag spellings. git diff --check passes. Tests reused the existing dependency/build cache under shared build/runtime locks; no logs are committed.

Limits: --rmi and long-form volume mounts remain unsupported. Custom networks require macOS 26 or later. Network driver/options, attachable, and IPv6 settings remain unsupported. Apple’s runtime rejected attaching one ext4 volume to two running VMs, so preservation coverage uses a volume attached to the surviving VM. An initial fixed-port fixture collided with an existing host listener; its port requirement was removed, and only that failed test project's resources were cleaned up.

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.

1 participant