Add container clean with mount namespace trimming - #2068
Draft
recrack wants to merge 8 commits into
Draft
Conversation
This was referenced Aug 4, 2026
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.
Important
This draft builds on #1949 by @saehejkang. The original commits and authorship are preserved. It remains a draft until apple/containerization#830 is agreed, the dependency revision is updated, and the allocated-size integration assertions are finalized.
Type of Change
Motivation and Context
Add
container cleanto trim unused blocks from a running container's root filesystem and named block volumes without recreating the container.Named volumes are mounted in the workload container's mount namespace, not vminitd's namespace. The companion apple/containerization#830 carries the workload container ID through filesystem-operation RPCs, pins the init process root to avoid PID-reuse races, and resolves canonical container paths with
openat2(RESOLVE_IN_ROOT | RESOLVE_NO_MAGICLINKS).This draft updates #1949 to the current
main, resolves its API and test-fixture conflicts, adds runtime identity validation, and expands the integration coverage. It is an alternative continuation of the existing work rather than an unrelated implementation. Maintainers and the original author can choose whether to continue here or fold these commits back into #1949.Closes #1763.
Changes
container cleanCLI and API/runtime routesTesting
Commands and results
make fmtswift build -Xswiftc -warnings-as-errors --build-testsmake containervminit:latestDependency
This PR should remain a draft until apple/containerization#830 is merged and the package dependency is updated to its merged revision.