1

I am trying to containerize a legacy frozen application. It requires D drive to be present else installation fails. I tried following the instructions in this post.

Docker build successful but my package installation fails. When I go into interactive mode, I cannot do

cd D:\

My docker file -

FROM mcr.microsoft.com/windows/servercore:ltsc2019
RUN dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
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;
RUN mkdir "D:\test"
SHELL ["cmd", "/C"]
CMD [ "cmd" ]
user9969157
  • 75
  • 4
  • 14
  • Rather than using dism to install IIS, can I recommend you use the IIS image? It comes with IIS pre-installed and Service Monitor which allows you to not exit the image if you don't have an EntryPoint. Image is: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019 – Vinicius Apolinario May 16 '23 at 16:32

1 Answers1

1

You don't go into any detail about "I cannot do cd D:\", so I'm guessing.

In Windows cmd.exe, there is a separate working directory for each drive. This means that cd D:\ changes the working directory for the D: drive, but doesn't change the working directory that you're looking at (because you're still on the C: drive).

You need to cd /d D:\ to change the current drive along with the working directory.

Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380