Docker Community Forums

Share and learn in the Docker community.

Cannot Map Volume to VHD with SQL Server

Apologies, I’m not sure which Category this fits in.

I’m having an issue with mapping volumes with my SQL Server Container, but it’s a strange one. ANY help appreciated (even if it’s just “this isn’t possible”).

I’m using Docker on Windows. I’m running a Linux SQL Server in a Linux Container on Windows 10.

Basically I’ve tried this and this WORKS:

docker run --name SQLServer
-e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD="MyT3$tSQLS£rver"
-e MSSQL_AGENT_ENABLED=true -p 1500:1433
-v E:/SQLServer/data:/var/opt/mssql/data -v E:/SQLServer/log:/var/opt/mssql/log
-v E:/SQLServer/secrets:/var/opt/mssql/secrets `
-d mcr.microsoft.com/mssql/server:2017-latest

As mentioned, this is completely fine and it works as expected.

However, what I’ve done (this is a test for another environment where this is applicable) is to create a VHD on my E drive. This VHD has been formatted and allocated the Z drive letter on my machine. This works just fine. I can access the Z drive, add files and folders etc.

But this code does NOT work and I don’t know why:

docker run --name SQLServer
-e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD="MyT3$tSQLS£rver"
-e MSSQL_AGENT_ENABLED=true -p 1500:1433
-v Z:/SQLServer/data:/var/opt/mssql/data -v Z:/SQLServer/log:/var/opt/mssql/log
-v Z:/SQLServer/secrets:/var/opt/mssql/secrets `
-d mcr.microsoft.com/mssql/server:2017-latest

If I run this it will create the data, log, and secrets folders on the Z drive and therefore I know it can see the Z drive… but it will not create any mdfs or ldfs there. The folders remain empty.

As mentioned, this works fine with the E drive. The files are created as I’d expect and therefore persisted locally outside the container. But the Z drive will not. The only difference is that it’s a VHD.

Any help appreciated.

Thanks,
Kevin