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

WCOW fails to load custom frontend #4892

Open
pl4nty opened this issue Apr 29, 2024 · 3 comments
Open

WCOW fails to load custom frontend #4892

pl4nty opened this issue Apr 29, 2024 · 3 comments

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

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

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

No branches or pull requests

4 participants