Search code examples
docker-for-windows

Docker build fails always with error hcsshim::PrepareLayer - failed failed in Win32: Incorrect function. (0x1) Windows Containers


Steps to reproduce are very easy.

Create a Dockerfile.

My Dockerfile has many more lines, but I have trimmed them so we can focus in the source of the problem.

Said that, these two lines alone (without anything more) show the problem.

FROM microsoft/iis
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; $VerbosePreference = 'Continue'; "]

Run docker build . and you get hcsshim::PrepareLayer - failed failed in Win32: Función incorrecta. (0x1).

Windows 10 Pro 1909 (but it happened too in 1903)

Docker version: 2.1.0.5

Engine: 19.03.5

Machine: 0.16.2


Solution

  • I have found the solution to the problem.

    Reading all the https://github.com/docker/for-win/issues/3884 bug, some have found a simple solution: rename C:\windows\system32\driver\cbfsconnect2017.sys so it isn't loaded the next boot.

    Disabling that driver enables me to do a docker build for the first time in windows containers in almost a year.

    In my case Box Sync was the one using that driver.

    EDIT: @GustavoTM have found that pCloud raises the same problem. EDIT2: @VonC have noticed that some people in the issue in GitHub has solved it deleting this other file: C:\Windows\System32\drivers\cbfs6.sys. I haven't tried that, but i put it if it helps others.

    The good thing is that I don't need to uninstall Box, but only rename that file.