7

How do I add a D: drive to the microsoft/windowsservercore base image? My Windows Server 2016 server has a D: drive. The server is an AWS instance. This is with native Docker installed and not the "Docker for Windows" that has been around for a while.

2 Answers2

7

We got it to work. Essentially, we're adding a symbolic link in the registry.

Add this to the dockerfile:

RUN powershell -NoProfile -Command \
    New-Item -ItemType directory -Path C:\drived ; \
    New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices' -Name 'D:'  -Value '\??\C:\drived' -PropertyType String;
1

I did this using the subst command:

mkdir c:\drived
subst d: c:\drived

I think such a drive is only visible in the current session, so it wouldn't work if you are using Windows services.

Joe
  • 122,218
  • 32
  • 205
  • 338