Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add D: Drive to Windows Server 2016 Docker Images

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.

like image 322
Hodor's Speech Therapist Avatar asked Oct 24 '16 18:10

Hodor's Speech Therapist


People also ask

Can Docker be installed on D drive?

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.

How do I change Docker storage location in Windows?

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.

Is Docker compatible with Windows Server 2016?

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.


1 Answers

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;
like image 141
Hodor's Speech Therapist Avatar answered Sep 29 '22 07:09

Hodor's Speech Therapist