Create D drive in a docker container

2019-07-11 18:17发布

问题:

Is it possible to create a new partition with a drive letter other than C: in a docker Windows container?

I need a D:\ and an E:\ drive for some software.

回答1:

I don't think you can do it from an existing image, but if you make a Dockerfile like so:

FROM <Base image like microsoft/dotnet-framework>
VOLUME ["D:"]
# Rest of Docker file here

The Windows container will create a D: Drive.



回答2:

This works in native Windows Server containers, but I had issues with it on docker-for-windows (Windows 10)

VOLUME ["D:"]

So for those in the same predicament, I found this worked for both.

Add D: Drive to Windows Server 2016 Docker Images