Docker mount D: Drive on Windows container - CreateComputeSystem: The parameter is incorrect

Expected behavior

I have a windows server 2019 and try to run a docker windows container. I try to mount a volume like this:

docker run -it -v d:\test\:d:\test\ cmd.exe

It should mount the local folder d:\test in the container under the same path d:\test

Actual behavior

but I get this error massage:

cleanup: failed to delete container from containerd: no such container
docker: Error response from daemon: hcsshim::CreateComputeSystem: The parameter is incorrect.

But the following examples work fine:

docker run -it -v c:\test\:c:\test\ cmd.exe
docker run -it -v d:\test\:c:\test\ cmd.exe

okay so the image does not have a D: drive. So I created a image with this Dockerfile:

FROM as base

But still the same error.

So why does docker only allow me to mount to c drive?

I can’t really change the mount part of the docker run command since it comes from jenkins. Do I need to create the d drive in the image differently? Is there any way I can debug this farther? How do you mount to a Windows Container a drive that is not C?


Thats not how that works im afraid, the “VOLUME” command just gives the information to docker, that its possible to mount d:, but it dosnt validate anything, its more like an info.

Im not sure that you can just create d:, but im not a big windows guy so im not sure :sweat_smile:

It looks like you can create a volume and that way create a D drive, but you can’t mount anything to that drive. I would just use the C drive, but if your application expects to be a D drive, you could trycreating a symbolic link from D:\test to C:\test and still mount your local folder to C:\test. I don’t know the reason of this behavior, but Linux doesn’ have drive letters like Windows, so when you create a volume in the Dockerfile, it will just create a folder on your host and mount it to the container. You can’t and you don’t need to specify on which partition or disk, because those are on the host. Windows containers have limitations compared to Linux containers, but sometimes there can be features for Windows which does not make sense on Linux. I don’t know how that D drive is created in the container, but it is possible that it just creates a virtual drive. If that drive somehow takes time to be mounted it will not be there when the container starts.

I am just guessing. I tried to figure out how Windows creates that drive, but I still don’t know.

So, all comments above are correct. To add on top of that: There’s no D drive on windows containers by default and the option you provided on Docker doesn’t work on Windows containers.
On a regular Windows system, drives are usually assigned a drive letter. There’s an option to assign a path to drives, but less used. With that, one alternative could be to create a new VHD (virtual disk), on the existing C:\ drive and then mount the VHD as D:. However, I just opened a new windows container and the command to create new VHDs is not there, which leads me to believe it is not supported.

If your application cannot read from something else, I think the symlink is the best option. But, I still think it might fail as you don’t have a D:\ drive.

1 Like