1

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.

Thom A
  • 88,727
  • 11
  • 45
  • 75
Nathan
  • 675
  • 2
  • 9
  • 20

1 Answers1

4

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.

Nathan
  • 675
  • 2
  • 9
  • 20
  • 1
    thanks for this comment, I also faced the same problem, creating `mdf` and `ldf` files helped, the "owerwrite existing files" option should also be enabled when creating the base from bak file! – serge Jun 08 '21 at 15:16
  • in addition to @serge comment, must also uncheck "take tail-log backup before restore" – jokab Sep 29 '22 at 03:52