7

I just installed the latest Windows 10 Pro 20H2. After installing Docker Desktop and switching it for Windows containers, it asked me to do the following

Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All

After this was done, my PC restarted and all seem good. Then I saved the Dockerfile below in an empty directory under my Documents. I build this Dockerfile with success in a CI system before, but I want to build in my machine for quicker development cycle.

FROM mcr.microsoft.com/windows/servercore:ltsc2019

RUN powershell -NoLogo -NoProfile -Command \
    netsh interface ipv4 show interfaces ; \
    netsh interface ipv4 set subinterface 18 mtu=1460 store=persistent ; \
    netsh interface ipv4 show interfaces ; \
    Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) ; \
    choco install -y --no-progress git --params "/GitAndUnixToolsOnPath" ; \
    choco install -y --no-progress 7zip ; \
    Remove-Item C:\ProgramData\chocolatey\logs -Force -Recurse ;

I want to build this Dockerfile, so on the directory that contains it, in Powershell I typed:

docker build .

But I got the error:

[+] Building 0.0s (2/2) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                    0.0s
 => => transferring dockerfile: 646B                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                         0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: failed to mount C:\ProgramData\Docker\tmp\buildkit-mount316756066: [{Type:bind Source:C:\ProgramData\Docker\windowsfilter\exjneuxdwo67rh9g5rfomdpc2 Options:[rbind ro]}]: invalid windows mount type: 'bind'

What is this error invalid windows mount type: 'bind' ?

docker --version
Docker version 19.03.13, build 4484c46d9d`

I also followed the docs here: https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/building-sample-app but still got the same invalid windows mount type: 'bind' error.

3 Answers 3

13

image

In docker settings, make sure to have buildkit set to false as below:

  "features": {
    "buildkit": false
  }

After this is applied and successfully restarted, the build should proceed.

In the docs, it's currently mentioned BuildKit is a feature "only supported for building Linux containers" : https://docs.docker.com/develop/develop-images/build_enhancements/

Unfortunately in a fresh install it's value defaults to true and doesn't change to false when switching to Windows Containers.

2
  • I pinged Docker on this and the feedback I'm hearing is that buildkit is not enabled by default when you switch to Windows containers. If you're seeing otherwise, open up an issue with the steps to reproduce at github.com/docker/for-win/issues
    – BMitch
    Commented Dec 7, 2020 at 15:09
  • 2
    Still got this issue today on a fresh Windows 10 and new installation. And Docker wants to charge for Docker Desktop...
    – zhanke
    Commented Jan 13, 2022 at 13:21
0

This is also impacted by the environment variable DOCKER_BUILDKIT, which can override the setting in the config file.

A value of 1 enables it, a value of 0 disables it.

0

If flipping buildkit to false doesn't work for you:

You should also be sure that your Visual Studio is running as Administrator. The Docker files for binding are not accessible otherwise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.