Repository navigation
Request the whole context when BuildKit sends no followpaths - #105
Merged
Merged
Conversation
BuildKit omits followpaths when a build step needs the whole context, for example RUN --mount=type=tmpfs. The shim treated that as "not supplied" and substituted a list built from the Dockerfile, which held only the first source of each COPY. The host then packed too few files and the build failed with a misleading "not found" error. Send "." for an empty followpaths and remove the Dockerfile-derived fallback. Fixes apple#104
JaewonHur
approved these changes
Oct 22, 2026
3 of 7 tasks
jglogan
pushed a commit
to apple/container
that referenced
this pull request
Oct 28, 2026
- Resolves #2405 in conjunction with apple/container-builder-shim#105 which resolves the root cause in the builder shim and #2434 which brings in the new shim. - When BuildKit evaluates instructions requiring the full build context (such as steps with tmpfs mounts), it emits a Walk request with empty or omitted followpaths metadata. BuildFSSync previously defaulted missing followpaths to [], resulting in no context files being packed into the archive. - This change defaults omitted or empty followpaths to ["."], ensuring the entire context is served as expected by BuildKit's filesync protocol.
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.
RUN --mount=type=tmpfs#104Important
Currently, tmpfs mounts are broken, and this change fixes that problem. However, it means that if a tmpfs mount appears in the Dockerfile, the entire build context will be sent and not just what would normally result from BuildKit's FollowPaths analysis.
Analysis
The challenge here is that the shim cannot distinguish the following cases where followPaths is "":
COPY . .where "/" is exactly what's neededBecause the shim can't distinguish these cases, requesting the whole context is the only always-correct response; narrowing the tmpfs case would have to happen in BuildKit.
Relevant call sites
These are at the shim's main commit c328f21, before your fix.
container-builder-shim/pkg/fssync/walk.go
Lines 216 to 227 in c328f21
container-builder-shim/pkg/fssync/walk.go
Lines 108 to 111 in c328f21