fix: frontend/gateway: leave mount type as nil for Windows
Added a check to exclude Windows OS when adding bind mount types to container image bundle. Bind types apply to Linux OS; hcsshim accepts empty bind types for Windows container creation. #4892
More info, what I was trying to achieve
-
I attempted to build a custom Docker frontend image(resides in dockerhub:docker.io/100909/dockerfile-4892) using the following Dockerfile:
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 AS release LABEL moby.buildkit.frontend.network.none="true" LABEL moby.buildkit.frontend.caps="moby.buildkit.frontend.inputs,moby.buildkit.frontend.subrequests,moby.buildkit.frontend.contexts" COPY /dockerfile-frontend.exe /bin/dockerfile-frontend.exe ENTRYPOINT ["/bin/dockerfile-frontend.exe"] FROM releaseThe
dockerfile-frontend.exewas built frombuildkit/frontend/dockerfile/cmd/dockerfile-frontend. -
I created another Dockerfile referencing the custom frontend image:
# syntax=docker.io/100909/dockerfile-4892 -
I ran the following command:
buildctl build --frontend=dockerfile.v0 --local context=path_to_dockerfile_in_step_2 --local dockerfile=path_to_dockerfile_in_step_2 --output type=image,name=testimage,push=falseThis resulted in an error during container creation in
hcsshim:error: failed to solve: failed to create shim task: invalid OCI spec - Type 'bind' not supported: unknown -
I made changes in BuildKit to fix the error in step 3 and ran
buildctlagain.Container creation stage passes,
I am getting a new error shown below when building the custom dockerfile frontend as in step 2.
sh error: failed to solve: exit code: 2
This commit fixes the error in step 3. @tonistiigi I am seeking ideas and comments.
Don't forget to sign-off your commits, see this failed run.
Is this PR close to a ready state @billywr? Just wanted to make sure it didn't get lost ;)
@profnandaa What's the state of this? Is it a temporary patch? Even if Windows doesn't call these mounts "type=bind" internally, this is still how they should be called in Dockerfile.
@profnandaa What's the state of this? Is it a temporary patch? Even if Windows doesn't call these mounts "type=bind" internally, this is still how they should be called in Dockerfile.
Seems we will have to do this fix from the HCS side instead. Let us go over it with Billy once he's back from PTO next week.
Let's put this on hold alittle bit until we have an end-to-end solution. Billy's leave is extended a little till end of month.
I've also found some similarities while tackling the llb.AddMount + RUN --mount issue, the initial failure is the same:
invalid OCI spec - Type '___' not supported from hcsshim. I have worked through some hacks to get that working but still digging through for a clean solution. ref: #5678