Why I am unable to mount a volume with a Windows Container? RRS feed

  • Question

  • I have the following simple Dockerfile:

    WORKDIR /azp
    COPY test.ps1 .
    CMD powershell .\test.ps1

    With the test.ps1 containing just dir /

    It seems to work:

    C:\test> docker run test
        Directory: C:\
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d-----         1/4/2020   7:30 PM                azp
    d-r---       11/28/2019  11:35 PM                Program Files
    d-----       11/28/2019  11:33 PM                Program Files (x86)
    d-r---       11/28/2019  11:36 PM                Users
    d-----         1/4/2020   7:30 PM                Windows
    -a----        9/15/2018   5:42 AM           5510 License.txt

    Now I am trying to run it while mounting a volume:

    C:\test> docker run test --mount 'type=volume,source=myvol2,target=/host'
    C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container e2ef2512b7ffc8bb91beff12e0883b7a4a19aa04eaa54de18231209505aa2789 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
    [Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
    [Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
    [Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF6A7DD9D2B: (caller: 00007FF6A7D8E13A) Exception(2) tid(398) 80070002 The system cannot find the file specified.
     Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"--mount type=volume,source=myvol2,target=/host","WorkingDirectory":"C:\\azp","CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}.

    What is going on? How to fix it?

    I am running Windows 10 with the latest docker switched over to Windows Containers.

    Sunday, January 5, 2020 12:34 AM