SQL Server 2019 with Docker Desktop - Restore Database error

Viewed 833

I have installed Docker Desktop and I have successfully got my 2019 SQL Server container running. It is pretty basic, here is my docker run command:

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<Strong Password>" --name "sql1" -h "sql1" -e "MSSQL_PID=Developer" -p 1433:1433 -v D:\2019DBs\data:/var/opt/mssql/data -v D:\2019DBs\log:/var/opt/mssql/log -d mcr.microsoft.com/mssql/server:2019-latest

But when I go to restore a backup that that I placed in D:\2019DBs\data. I get the below error:

System.Data.SqlClient.SqlError: The operating system returned the error '1(Incorrect function.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on '/var/opt/mssql/data/Test.mdf'. (Microsoft.SqlServer.SmoExtended)

I can create an empty database without a problem. I am not sure what else to do.

1 Answers

A way to get this to work was manually create the .mdf, .ndf, and .ldf files in the directory then the restore worked. Not sure if this is ideal or why this would be the case but that is how I got it to work.

Related