WCOW: support RUN --mount=type=secret - #6944
Open
rzlink wants to merge 1 commit into
Open
Conversation
rzlink
force-pushed
the
wcow-secret-mount
branch
from
July 13, 2026 21:17
1ac8a2b to
d6c0abb
Compare
Collaborator
Author
Thanks for the review! The failing checks were caused by two existing Windows dockerfile tests ( TestOutlineSecrets , TestSecretRequiredWithoutValue ) that used targetless secrets — which the new Windows code path now rejects, since a target is required on Windows (there's no /run/secrets default). I've updated those tests to pass explicit targets. All checks are green now. PTAL when you get a chance. |
Collaborator
Author
|
@crazy-max Could you please take a look at this PR when you have some time? Thanks! |
crazy-max
requested changes
Jul 27, 2026
crazy-max
left a comment
Member
There was a problem hiding this comment.
Can you also rebase with master to make sure Go 1.26 bump in go.mod doesn't introduce lint issue? Thanks
Comment on lines
+16
to
+19
| if isWindows { | ||
| // Normalize backslashes so C:\path\to\secret resolves to an absolute path. | ||
| m.Target = system.ToSlash(m.Target, "windows") | ||
| } |
Member
There was a problem hiding this comment.
Would prefer to avoid mutating m.Target:
Suggested change
| if isWindows { | |
| // Normalize backslashes so C:\path\to\secret resolves to an absolute path. | |
| m.Target = system.ToSlash(m.Target, "windows") | |
| } | |
| targetPath := m.Target | |
| if isWindows { | |
| targetPath = system.ToSlash(targetPath, "windows") | |
| } |
rzlink
force-pushed
the
wcow-secret-mount
branch
from
July 27, 2026 23:35
d6c0abb to
31d5496
Compare
Secret mounts previously failed on Windows with invalid windows mount type: 'tmpfs' because the secret mount setup hardcoded a tmpfs scratch dir, which the Windows containerd mount layer rejects (only 'windows-layer' is allowed). Split secretMountInstance.Mount() into platform files. The Unix path is unchanged. The Windows path writes the secret to a temp file and returns a single-file, read-only bind mount (no tmpfs), and applies a protected DACL granting access only to SYSTEM, Administrators and the daemon account - the Windows analog of the Unix chmod(0600). The dockerfile frontend now requires an explicit target on Windows, as there is no POSIX-style /run/secrets default. UID/GID/mode are unsupported on Windows and ignored. Adds unit and integration tests and documents the Windows behavior in the Dockerfile reference. Signed-off-by: Dawei Wei <wei.dawei.cn@gmail.com>
rzlink
force-pushed
the
wcow-secret-mount
branch
from
July 28, 2026 00:00
31d5496 to
752906f
Compare
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.
This enables
RUN --mount=type=secretfor Windows containers (WCOW). Previously the build failed withinvalid windows mount type: 'tmpfs', because the secret mount was always set up as a Linux tmpfs, which the Windows containerd mount layer rejects.Since Windows has no tmpfs, the secret is written to a temporary file on the host and exposed to the build step as a read-only, single-file bind mount (via the HCS bind filter). Access is restricted with an explicit protected DACL that grants only
SYSTEM,Administrators, and the build's own user account, which is the Windows analog of the0600permissions used on Linux.Some Linux-only behaviors do not apply on Windows: a
targetmust be given explicitly (there is no/run/secretsdefault), and theuid/gid/modeoptions are ignored. After the mount is released, an empty placeholder directory may remain at the target; the secret value itself is not persisted into the image layer.fixes #5273
relates to #5678