Reputation: 141
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.
Upvotes: 7
Views: 4188
Reputation: 124746
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.
Upvotes: 1
Reputation: 141
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;
Upvotes: 7