Skip to content

WCOW: COPY --from failing with failed to walk error on Windows 11 #5193

Closed
@danielGithinji

Description

Docker desktop version 4.32.0
Buildkit version 0.15.1

Operating system: Windows 11

I have run the following dockerfile with both docker desktop and buildkit and below are the results:

FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS build
RUN echo helloworld > out

FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
COPY --from=build /out /out

Docker command results below are successful in building an image

docker build --no-cache -t my-nanoserver-app .

Sending build context to Docker daemon  242.2MB
Step 1/9 : ARG a1="nanoserver:ltsc2022"
Step 2/9 : ARG a2
Step 3/9 : FROM mcr.microsoft.com/windows/$a1 AS build
 ---> f0ca29645006
Step 4/9 : ARG a2="nanoserver-foo"
 ---> Running in 5ff4930ad31b
 ---> Removed intermediate container 5ff4930ad31b
 ---> 9776575fecc4
Step 5/9 : ARG a3
 ---> Running in 1845c3aab27d
 ---> Removed intermediate container 1845c3aab27d
 ---> d9437ada429c
Step 6/9 : SHELL ["cmd", "/S", "/C"]
 ---> Running in 05828541ddf6
 ---> Removed intermediate container 05828541ddf6
 ---> aac8330748be
Step 7/9 : RUN echo bar-%a2% > C:\\out
 ---> Running in 7c3082aad152
 ---> Removed intermediate container 7c3082aad152
 ---> 016152b960bd
Step 8/9 : FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
 ---> f0ca29645006
Step 9/9 : COPY --from=build C:\\out C:\\out
 ---> 6ea0ec197aa1
Successfully built 6ea0ec197aa1
Successfully tagged my-nanoserver-app:latest

Buildkit command results:

 buildctl build `
>> --frontend=dockerfile.v0 `
>> --local context=. \ `
>> --local dockerfile=. `
>> --output type=image,name=my-nanoserver-app:v1,push=false `
>> --progress plain `
>> --no-cache

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 333B 0.0s done
#1 DONE 0.1s

#2 [internal] load metadata for mcr.microsoft.com/windows/nanoserver:ltsc2022
#2 DONE 1.4s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [build 1/2] FROM mcr.microsoft.com/windows/nanoserver:ltsc2022@sha256:cc9f6a1334190c1f18a905f56d285132e562a9a1ce18ff9476cfaf95194aa0b7
#4 resolve mcr.microsoft.com/windows/nanoserver:ltsc2022@sha256:cc9f6a1334190c1f18a905f56d285132e562a9a1ce18ff9476cfaf95194aa0b7 0.0s done
#4 CACHED

#5 [build 2/2] RUN echo bar-%a2% > C:\out
#5 DONE 1.2s

#6 [stage-1 2/2] COPY --from=build C:\out C:\out
#6 ERROR: failed to calculate checksum of ref 176tvlj7tnwnyvkujk5ps5q0v::vwg2hzqc62xfuk6vw34x6ax43: failed to walk C:\Users\DGITHI~1\AppData\Local\Temp\buildkit-mount3999950507\WcSandboxState: open C:\Users\DGITHI~1\AppData\Local\Temp\buildkit-mount3999950507\WcSandboxState: Access is denied.
------
 > [stage-1 2/2] COPY --from=build C:\out C:\out:
------
Dockerfile:11
--------------------
   9 |
  10 |     FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
  11 | >>> COPY --from=build C:\\out C:\\out
--------------------
error: failed to solve: failed to compute cache key: failed to calculate checksum of ref 176tvlj7tnwnyvkujk5ps5q0v::vwg2hzqc62xfuk6vw34x6ax43: failed to walk C:\Users\username\AppData\Local\Temp\buildkit-mount3999950507\WcSandboxState: open C:\Users\username\AppData\Local\Temp\buildkit-mount3999950507\WcSandboxState: Access is denied.

The buildkit command result fails above fails partly because of an "Access is denied" error at the given directory. I'm running both commands as administrator in the Windows terminal.

After running the buildkit command on Windows server 2022 I get a successful response as seen below:

#8 [stage-1 2/2] COPY --from=build /out /out
#8 DONE 0.4s

#9 exporting to image
#9 exporting layers
#9 exporting layers 0.5s done
#9 exporting manifest sha256:058f1fb53f5d61ac1265f5934799de7720161ab6fc6bb5327c9da52436295a92 0.0s done
#9 exporting config sha256:640266655f00287d4909cb67866c68e0b2a3bb077a51272ce89e455ec3cf4e3f 0.0s done
#9 naming to comm-checkin/hello-buildkit 0.0s done
#9 DONE 0.6s

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions