Windows-Containers
Windows-Containers copied to clipboard
Docker builds of windows-based containers always fails with "hcsshim::PrepareLayer - failed failed in Win32: Incorrect function. (0x1)"
This is a repost from https://github.com/docker/for-win/issues/12520, where I was referred to this project instead.
Actual behavior
Trying to build a Windows-based container results in the following error every time:
hcsshim::PrepareLayer - failed failed in Win32: Incorrect function. (0x1)
I have tried this with both windows/nanoserver and windows/servercore images
Expected behavior
A successful Dockerfile build without this error
Information
- Windows Version: Windows 10 Pro, 10.0.19041 Build 19041
- Docker Desktop Version: 4.4.4 (73704)
- WSL2 or Hyper-V backend? Hyper-V
- Are you running inside a virtualized Windows e.g. on a cloud server or a VM: No, just a local PC
Output of & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check
[027:08:49:15.140][I] ipc.NewClient: fc62ff43-com.docker.diagnose -> \.\pipe\dockerBackendV2 com.docker.service.exe [goroutine 1 [running, locked to thread]: [win/backend/pkg/service.NewClientForPath(...) [ win/backend/pkg/service/service.go:40 [win/backend/pkg/service.NewClient({0x118e8be, 0x13}, {0x0, 0x0, 0x0}) [ win/backend/pkg/service/service.go:29 +0xe8 [common/pkg/diagkit/gather/diagnose.init() [ common/pkg/diagkit/gather/diagnose/ipc_windows.go:23 +0x11f Starting diagnostics
[PASS] DD0027: is there available disk space on the host? [PASS] DD0028: is there available VM disk space? [PASS] DD0031: does the Docker API work? [PASS] DD0004: is the Docker engine running? [PASS] DD0011: are the LinuxKit services running? [PASS] DD0016: is the LinuxKit VM running? [PASS] DD0001: is the application running? [SKIP] DD0018: does the host support virtualization? [PASS] DD0002: does the bootloader have virtualization enabled? [PASS] DD0017: can a VM be started? [PASS] DD0023: is the Containers Windows Feature enabled? [PASS] DD0015: are the binary symlinks installed? [PASS] DD0003: is the Docker CLI working? [PASS] DD0013: is the $PATH ok? [PASS] DD0005: is the user in the docker-users group? [PASS] DD0007: is the backend responding? [PASS] DD0014: are the backend processes running? [PASS] DD0008: is the native API responding? [PASS] DD0009: is the vpnkit API responding? [PASS] DD0010: is the Docker API proxy responding? [PASS] DD0006: is the Docker Desktop Service responding? [PASS] DD0012: is the VM networking working? [PASS] DD0032: do Docker networks overlap with host IPs? [SKIP] DD0030: is the image access management authorized? [PASS] DD0033: does the host have Internet access? No fatal errors detected.
Steps to reproduce the behavior
Step 1: Create this Dockerfile:
FROM mcr.microsoft.com/windows/nanoserver:10.0.19041.1415-amd64
RUN echo hello
RUN echo goodbye
CMD [ "cmd.exe" ]
Step 2: Execute the following command from in the same directory:
docker build .
I get the following output every time:
Sending build context to Docker daemon 3.473GB Step 1/4 : FROM mcr.microsoft.com/windows/nanoserver:10.0.19041.1415-amd64 ---> c7d5f0d992fa Step 2/4 : RUN echo hello ---> Running in b1ed8fa3108b hello
hcsshim::PrepareLayer - failed failed in Win32: Incorrect function. (0x1)
That's odd. I ran your Dockerfile on a Server 2022 host and it built fine. I'm on:
Docker version 20.10.7, build 40ef3b6
I know you said Docker Desktop 4.4.4 - what version of the docker engine is that?
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM mcr.microsoft.com/windows/nanoserver:10.0.19041.1415-amd64
---> c7d5f0d992fa
Step 2/4 : RUN echo hello
---> Running in 98176c59884a
hello
Removing intermediate container 98176c59884a
---> 2ca530e272eb
Step 3/4 : RUN echo goodbye
---> Running in 83f963fe0d25
goodbye
Removing intermediate container 83f963fe0d25
---> 3230828fe95d
Step 4/4 : CMD [ "cmd.exe" ]
---> Running in 2fc6e931c27e
Removing intermediate container 2fc6e931c27e
---> afe7e16c5889
Successfully built afe7e16c5889
@michbern-ms I have since tried this on a different win10 Pro PC and it also worked fine. Is it possible there's some sort of conflict with other installed software? That error message is not very informative.
Kyle I'm going to close this issue since we can't repro it any longer. If this issue comes back, we can reopen.
@cwilhit I can actually still reproduce it easily, just only on my main win10 pro PC. I'd love to get to the bottom of what is causing the failure, since I can't really rely on this technology if it fails to work on my main development system.
Ah, you succeeded on a different machine. OK, reopening this issue so we can have it to track.
I'm also happy to run any tests or collect any debug information that may be helpful in solving this.
Much appreciated, let me follow up with you on that. Opening MSFT-internal 38264446 as reference.
@KyleL1 can you please try building this exact same Dockerfile with Docker Desktop 4.3.2 and let me know if that works? I have hunch about what might be causing this but I want to know if the build works on older Docker desktop version.
Unfortunately it did not:
PS C:\Users\test> docker version Client: Cloud integration: v1.0.22 Version: 20.10.11 API version: 1.41 Go version: go1.16.10 Git commit: dea9396 Built: Thu Nov 18 00:42:51 2021 OS/Arch: windows/amd64 Context: default Experimental: true
Server: Docker Engine - Community Engine: Version: 20.10.11 API version: 1.41 (minimum version 1.24) Go version: go1.16.9 Git commit: 847da18 Built: Thu Nov 18 00:38:11 2021 OS/Arch: windows/amd64 Experimental: false PS C:\Users\test> docker build . Sending build context to Docker daemon 3.473GB Step 1/4 : FROM mcr.microsoft.com/windows/nanoserver:10.0.19041.1415-amd64 10.0.19041.1415-amd64: Pulling from windows/nanoserver 0179e587c053: Pull complete Digest: sha256:646e69e01e3e89baf7665f9a4a7a889b0bec862ce71a0b8c3e7644e0e07b7554 Status: Downloaded newer image for mcr.microsoft.com/windows/nanoserver:10.0.19041.1415-amd64 ---> c7d5f0d992fa Step 2/4 : RUN echo hello ---> Running in f153437cdc7a hello hcsshim::PrepareLayer - failed failed in Win32: Incorrect function. (0x1)
Thanks. I will continue investigating and update here if I find anything.
@KyleL1 One of our team members remembered this issue, which related to specific software installed on the Docker host: https://github.com/moby/moby/issues/42807 "having certain 'drive' software installed with certain versions of CBFS drivers causes Docker builds to fail with Windows containers, even with the most trivial Dockerfile."
Can you check and see if you have installed software on the host PC with a CBFS driver?
That was it! I ran "driverquery /v" and found an entry for CBFS6-0 from 2016. After I uninstalled the program responsible, the docker build worked!
Thanks so much for your help. Hopefully others won't fall into this same trap.
Visual Studio generates this same error for me on build, but I don't have the CBFS driver installed. Is there a chance that this can happen under the CimFS driver?
Still facing this issue on Win 10 Enterprise.
Sending build context to Docker daemon 3.072kB Step 1/2 : FROM mcr.microsoft.com/windows/servercore:ltsc2019 ---> 5f9e1fdbbeba Step 2/2 : SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ---> Running in f646e53d59dd hcsshim::PrepareLayer failed in Win32: Incorrect function. (0x1)
I dont have CBFS6 drive either.
Edition Windows 10 Enterprise Version 22H2 Installed on 06/02/2023 OS build 19045.3803 Experience Windows Feature Experience Pack 1000.19053.1000.0
I have same issue without CBFS6 driver installed.
on: Edition Windows 11 Pro Version 23H2 Installed on 18/12/2022 OS build 22631.3007 Experience Windows Feature Experience Pack 1000.22681.1000.0
Please reopen the issue now, Lots of users reporting this. #452
Pinged internal thread.
I just started having this issue a few days ago! None of these fix have worked.
I have same issue without CBFS6 driver installed.
on:
Edition Windows 11 Pro
Version 23H2
Installed on 18/12/2022
OS build 22631.3007
Experience Windows Feature Experience Pack 1000.22681.1000.0
@KonradZaremba did you get this resolved? I'm having the same issue since last week. Seemed to happen after windows update.
This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.
This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.
I have same issue without CBFS6 driver installed. on: Edition Windows 11 Pro Version 23H2 Installed on 18/12/2022 OS build 22631.3007 Experience Windows Feature Experience Pack 1000.22681.1000.0
@KonradZaremba did you get this resolved? I'm having the same issue since last week. Seemed to happen after windows update.
Nop I didn't I have to try after merge.
This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.
This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.
This issue has been open for 30 days with no updates. no assignees, please provide an update or close this issue.
Internal thread was closed so closing this Issue too.