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.
Make sure you change the drive that is referred to in the file to the drive you want to use (so if it should be drive D, rather than E, then make it “d:\\docker”!) If you already have an existing daemon. json file in the config folder, just add the line to the file.
Step 1 - Stop Docker Desktop. Step 2 - Relocate the existing directories %USERPROFILE%\AppData\Local\Docker and C:\ProgramData\Docker to new directories. For example - move %USERPROFILE%\AppData\Local\Docker to E:\Docker\AppData and C:\ProgramData\Docker to E:\Docker\ProgramData.
Docker Enterprise Edition is supported for use with Enterprise Server only on Windows Server 2016 so if you are using Windows 10 you must install Docker Desktop.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With