Add D: Drive to Windows Server 2016 Docker Images

ぃ、小莉子 提交于 2019-12-10 21:37:34

问题


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.


回答1:


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;



回答2:


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.



来源:https://stackoverflow.com/questions/40225407/add-d-drive-to-windows-server-2016-docker-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!