Docker Community Forums

Share and learn in the Docker community.

Docker Data Volumes and Windows mounts


(Mikehalfogre) #1

Hello –

I have browsed the forums here, lots of google searches, the git-hub documents and anywhere else I have been pointed. The question I cannot seem to get a firm answer for is the following

Does docker volumes for Windows only mount volumes on C:\ ? Or can I create standard windows mounts for a secondary drive letter, like say an E:\

Or do I need to define that at the host level before I create a container so it is available as a separate mount on a E: instead of a C: only mount? Or is windows is stuck with assuming everything resides on c:\ as a root and we are creating mounts to root in a fashion similar to the way you expect for Unix hosts?


(Michael Friis) #2

Is this for running Linux or Windows containers? As long as your share the drives, you can mount them into Linux containers run with Docker for Windows.

(my machine only has one drive, but had I had more, they would have shown up in that dialog)


(Mikehalfogre) #3

This is a question geared directly towards windows installations. We are investigating migrating an application into a docker container with Windows 2016 Server Core … but our installations use a separate E: Drive

The only options I have seen so far for Docker are to create Docker Volume containers and mount them to c:\ as a “dir” but that dir is a separate volume from the C: root

I have not found syntax that allows for mounting of a separate volume (MS-SQL server often has 3 extra volumes by Letter in windows for data separation).

Am I just not understanding the syntax, or is the current method only geared towards treating a Windows C: like a *NIX root drive with volumes attached to it?


(Bbmcgee) #4

I have the same issue. I was able to create a F: drive that was available in a running container with “VOLUME F:” in the dockerfile. However, I wasn’t able to actually do anything else with the volume in the dockerfile. For example, mkdir F:\somefolder in the dockerfile did not result in F:\somefolder existing in the running container. When I tried to COPY to F: in the dockerfile I got an error during build that docker for Windows only supports copying to the c:\ drive in the image. My workaround was to create the VOLUME F: in the dockerfile, copy to C: in the image, and set the ENTRYPOINT to a PowerShell script that did the F:\ drive operations at container run (e.g mkdir, copy from c: to f:, run processes that expect data on f:).


Read from named volume during build (not create or run)