Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: frontend/gateway: leave mount type as nil for Windows #5077

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

billywr
Copy link

@billywr billywr commented Jun 24, 2024

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

  1. 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 release

    The dockerfile-frontend.exe was built from buildkit/frontend/dockerfile/cmd/dockerfile-frontend.

  2. I created another Dockerfile referencing the custom frontend image:

    # syntax=docker.io/100909/dockerfile-4892
  3. 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=false

    This 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
    
  4. I made changes in BuildKit to fix the error in step 3 and ran buildctl again.

    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.

@xtrm-en
Copy link

xtrm-en commented Jul 4, 2024

Don't forget to sign-off your commits, see this failed run.

@billywr billywr changed the title Exclude Windows OS when adding bind mount types fix: frontend/gateway:exclude Windows OS when adding bind mount types Aug 12, 2024
@billywr billywr changed the title fix: frontend/gateway:exclude Windows OS when adding bind mount types fix:Exclude Windows OS when adding bind mount types Aug 12, 2024
@billywr billywr changed the title fix:Exclude Windows OS when adding bind mount types fix: frontend/gateway: leave mount type as nil for Windows Aug 14, 2024
@billywr billywr force-pushed the os-mount-types-check branch 2 times, most recently from f83390c to 534b6ff Compare August 19, 2024 11:20
@thompson-shaun
Copy link
Collaborator

Is this PR close to a ready state @billywr? Just wanted to make sure it didn't get lost ;)

@billywr billywr force-pushed the os-mount-types-check branch 2 times, most recently from fb193ed to 6af1547 Compare September 26, 2024 13:16
		-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.

Signed-off-by: Billy Owire <billyowire95@gmail.com>
@billywr billywr marked this pull request as ready for review October 28, 2024 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants