executor: restore mount points removed for rootless - #7039
Open
tonistiigi wants to merge 2 commits into
Open
Conversation
BuildKit records mount-stub cleanup before rootless conversion finishes changing the mount list, which can leave rootful and rootless builds with different empty directories. This change registers cleanup after rootless conversion, when the mount list is final, and uses that list for cleanup. Signed-off-by: Leo Li <cheerleaderleo@outlook.com>
The rootless spec conversion removes the /sys mount, so the runtime never creates its mount point in the rootfs. A rootful build gets that empty directory, which meant the same LLB left different mount points behind depending on whether the worker was rootless. Recreate the mount points of the removed mounts after the container has exited, rather than cleaning them up from the rootful result, which would change existing output and need a compatibility version bump. Creating them up front would instead turn a mount point that the image does not ship into a directory the build can write to. Nested destinations are skipped: the runtime creates those inside the parent mount, where they never reach the rootfs. Fixes moby#6686 Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
crazy-max
approved these changes
Aug 14, 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.
replaces #7033
The rootless spec conversion removes the /sys mount, so the runtime never
creates its mount point in the rootfs. A rootful build gets that empty
directory, which meant the same LLB left different mount points behind
depending on whether the worker was rootless.
Recreate the mount points of the removed mounts after the container has
exited, rather than cleaning them up from the rootful result, which would
change existing output and need a compatibility version bump. Creating
them up front would instead turn a mount point that the image does not
ship into a directory the build can write to. Nested destinations are
skipped: the runtime creates those inside the parent mount, where they
never reach the rootfs.
Fixes #6686