Skip to content

WCOW fails to load custom frontend #4892

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

Open
pl4nty opened this issue Apr 29, 2024 · 9 comments · May be fixed by #5868
Open

WCOW fails to load custom frontend #4892

pl4nty opened this issue Apr 29, 2024 · 9 comments · May be fixed by #5868

Comments

@pl4nty
Copy link

pl4nty commented Apr 29, 2024

Official custom frontends don't seem to be published for Windows yet, so I applied the following patch to publish my own at ghcr.io/pl4nty/dockerfile:master using frontend/dockerfile/cmd/dockerfile-frontend/hack/release.

frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile

-ARG TARGETPLATFORM
+ARG TARGETPLATFORM TARGETOS
 RUN --mount=target=. --mount=type=cache,target=/root/.cache \
   --mount=target=/go/pkg/mod,type=cache \
   --mount=source=/tmp/.ldflags,target=/tmp/.ldflags,from=version \
-  CGO_ENABLED=0 xx-go build -o /dockerfile-frontend -ldflags "-d $(cat /tmp/.ldflags)" -tags "$BUILDTAGS netgo static_build osusergo" ./frontend/dockerfile/cmd/dockerfile-frontend && \
+  CGO_ENABLED=0 xx-go build -o /dockerfile-frontend -ldflags '$([ "$TARGETOS" = "windows" ] && "" || "-d ")$(cat /tmp/.ldflags)' -tags "$BUILDTAGS netgo static_build osusergo" ./frontend/dockerfile/cmd/dockerfile-frontend && \
   xx-verify --static /dockerfile-frontend

Attempts to use it fail with the following error:

echo "# syntax=ghcr.io/pl4nty/dockerfile:master" > Dockerfile
docker buildx build .
[+] Building 2.6s (4/4) FINISHED                                                                      remote:nsc-remote
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 80B                                                                                0.0s
 => resolve image config for docker-image://ghcr.io/pl4nty/dockerfile:master                                       1.8s
 => [auth] pl4nty/dockerfile:pull token for ghcr.io                                                                0.0s
 => docker-image://ghcr.io/pl4nty/dockerfile:master@sha256:d8f195c869e936b277f8af94493f8e0e5d58864de916a7ead70b4b  0.7s
 => => resolve ghcr.io/pl4nty/dockerfile:master@sha256:d8f195c869e936b277f8af94493f8e0e5d58864de916a7ead70b4b0708  0.0s
 => => extracting sha256:6c11bae004a3c15df19ad2d172c417f04ad12fa661e9029c2a424e3f3155705a                          0.6s
WARNING: No output specified with remote driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:1
--------------------
   1 | >>> # syntax=ghcr.io/pl4nty/dockerfile:master
   2 |
--------------------
ERROR: failed to solve: hcsshim::ProcessBaseLayer \\?\C:\ProgramData\containerd\root\io.containerd.snapshotter.v1.windows\snapshots\6: The system cannot find the path specified.: unknown

I've followed the WCOW setup guide and replicated locally and on GitHub Actions. C:\ProgramData\containerd\root\io.containerd.snapshotter.v1.windows\snapshots exists locally, but only contains a 1 folder. I noticed the number increments after each build.

@profnandaa
Copy link
Collaborator

ACK, taking a look.

@billywr
Copy link
Contributor

billywr commented May 15, 2024

Attempting to build an image for WCOW from a custom frontend using BuildKit will result to error you got (ERROR: failed to solve: hcsshim::ProcessBaseLayer ....) if the custom frontend contains no base layer.

I created a new custom frontend with a NanoServer image as the base layer, but ended up encountering the error below.

  PS E:\repro-4892> docker buildx build .
[+] Building 1.3s (4/4) FINISHED                                                                                      remote:buildkit-exp
 => [internal] load build definition from Dockerfile                                                                                 0.1s
 => => transferring dockerfile: 80B                                                                                                  0.0s
 => resolve image config for docker-image://docker.io/100909/dockerfile-4892:latest                                                  0.4s
 => [auth] 100909/dockerfile-4892:pull token for registry-1.docker.io                                                                0.0s
 => CACHED docker-image://docker.io/100909/dockerfile-4892:latest@sha256:483bf8f1796a24323c1ea215016297988326afb84ddc97312e0fd17b7c  0.0s
 => => resolve docker.io/100909/dockerfile-4892:latest@sha256:483bf8f1796a24323c1ea215016297988326afb84ddc97312e0fd17b7caeb5ca       0.0s
WARNING: No output specified with remote driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:1
--------------------
   1 | >>> # syntax=docker.io/100909/dockerfile-4892
   2 |
--------------------
**

ERROR: failed to solve: failed to create shim task: invalid OCI spec - Type 'bind' not supported: unknown

**
View build details: docker-desktop://dashboard/build/buildkit-exp/buildkit-exp0/0gzd6kdf2hllfq7ygzllikkm2

------------

Investigations into the containerd and hcsshim source codes indicate that containerd passes 'windows-layer' as the mount type to hscshim. I suspect that hscshim could be generating predefined mount types (yet to ascertain this).

Any idea of the valid Mount Types for this case?

@profnandaa
Copy link
Collaborator

/cc. @gabriel-samfira

@billywr
Copy link
Contributor

billywr commented Apr 2, 2025

Attempting to build an image for WCOW from a custom frontend using BuildKit will result to error you got (ERROR: failed to solve: hcsshim::ProcessBaseLayer ....) if the custom frontend contains no base layer.

I created a new custom frontend with a NanoServer image as the base layer, but ended up encountering the error below.

  PS E:\repro-4892> docker buildx build .
[+] Building 1.3s (4/4) FINISHED                                                                                      remote:buildkit-exp
 => [internal] load build definition from Dockerfile                                                                                 0.1s
 => => transferring dockerfile: 80B                                                                                                  0.0s
 => resolve image config for docker-image://docker.io/100909/dockerfile-4892:latest                                                  0.4s
 => [auth] 100909/dockerfile-4892:pull token for registry-1.docker.io                                                                0.0s
 => CACHED docker-image://docker.io/100909/dockerfile-4892:latest@sha256:483bf8f1796a24323c1ea215016297988326afb84ddc97312e0fd17b7c  0.0s
 => => resolve docker.io/100909/dockerfile-4892:latest@sha256:483bf8f1796a24323c1ea215016297988326afb84ddc97312e0fd17b7caeb5ca       0.0s
WARNING: No output specified with remote driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:1
--------------------
   1 | >>> # syntax=docker.io/100909/dockerfile-4892
   2 |
--------------------
**

ERROR: failed to solve: failed to create shim task: invalid OCI spec - Type 'bind' not supported: unknown

**
View build details: docker-desktop://dashboard/build/buildkit-exp/buildkit-exp0/0gzd6kdf2hllfq7ygzllikkm2

------------

Investigations into the containerd and hcsshim source codes indicate that containerd passes 'windows-layer' as the mount type to hscshim. I suspect that hscshim could be generating predefined mount types (yet to ascertain this).

Any idea of the valid Mount Types f

Attempting to build an image for WCOW from a custom frontend using BuildKit will result to error you got (ERROR: failed to solve: hcsshim::ProcessBaseLayer ....) if the custom frontend contains no base layer.

I created a new custom frontend with a NanoServer image as the base layer, but ended up encountering the error below.

  PS E:\repro-4892> docker buildx build .
[+] Building 1.3s (4/4) FINISHED                                                                                      remote:buildkit-exp
 => [internal] load build definition from Dockerfile                                                                                 0.1s
 => => transferring dockerfile: 80B                                                                                                  0.0s
 => resolve image config for docker-image://docker.io/100909/dockerfile-4892:latest                                                  0.4s
 => [auth] 100909/dockerfile-4892:pull token for registry-1.docker.io                                                                0.0s
 => CACHED docker-image://docker.io/100909/dockerfile-4892:latest@sha256:483bf8f1796a24323c1ea215016297988326afb84ddc97312e0fd17b7c  0.0s
 => => resolve docker.io/100909/dockerfile-4892:latest@sha256:483bf8f1796a24323c1ea215016297988326afb84ddc97312e0fd17b7caeb5ca       0.0s
WARNING: No output specified with remote driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:1
--------------------
   1 | >>> # syntax=docker.io/100909/dockerfile-4892
   2 |
--------------------
**

ERROR: failed to solve: failed to create shim task: invalid OCI spec - Type 'bind' not supported: unknown

**
View build details: docker-desktop://dashboard/build/buildkit-exp/buildkit-exp0/0gzd6kdf2hllfq7ygzllikkm2

------------

Investigations into the containerd and hcsshim source codes indicate that containerd passes 'windows-layer' as the mount type to hscshim. I suspect that hscshim could be generating predefined mount types (yet to ascertain this).

Any idea of the valid Mount Types for this case?

this issues was resolved.... no longer needs feedback

@billywr
Copy link
Contributor

billywr commented Apr 2, 2025

@pl4nty if you dont mind can share the dockerfile for this image ghcr.io/pl4nty/dockerfile:master
alternatively push the image to docker reg, would wish test it, I am currently working on this wcow custom frontends issue, publishing PR soon, but wished also to test my changes using your scenario

@pl4nty
Copy link
Author

pl4nty commented Apr 2, 2025

@billywr the Dockerfile is frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile with the changes I provided, pushed to ghcr.io/pl4nty/dockerfile:master

@billywr
Copy link
Contributor

billywr commented Apr 8, 2025

Thank you for the reply.

I don't think the changes you made to the Dockerfile would result in a working WCOW custom docker frontend, since the Dockerfile references non-WCOW base images—unless you were specifically testing Linux containers on Windows.

I'm currently working on this PR, where I'll be updating the steps I used to create a sample custom frontend for WCOW. I would really appreciate your input on it.

@pl4nty
Copy link
Author

pl4nty commented Apr 12, 2025

I was building on a Linux host, and since the output Windows image is FROM scratch with a single COPY, I thought it was supported. But I now see the entrypoint is /bin/dockerfile-frontend, is this path format supported on WCOW?

@billywr
Copy link
Contributor

billywr commented Apr 15, 2025

no, should be something like , ENTRYPOINT ["C:\dockerfile-frontend.exe"]
also SCRATCH is not yet supported,
also ensure you are using windows base image , like in place of alpine you can have mcr.microsoft.com/windows/nanoserver:ltsc2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants