Restore SQL Server database within docker container error

Viewed 39

I tried to restore an SQL Server database within a docker container (SQL Server 2017), but it always shows the error

The operating system returned the error '1(Incorrect function.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on '/var/opt/mssql/data/release_129x.mdf'.

File 'EIS_411' cannot be restored to '/var/opt/mssql/data/release_129x.mdf'. Use WITH MOVE to identify a valid location for the file.

The operating system returned the error '1(Incorrect function.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on '/var/opt/mssql/data/release_129x.ldf'.

File 'EIS_411_log' cannot be restored to '/var/opt/mssql/data/release_129x.ldf'. Use WITH MOVE to identify a valid location for the file.

This is the command which I run:

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=365653wz" -p 1401:1433 -v D:\docker\mssql:/var/opt/mssql --name mssql -d mcr.microsoft.com/mssql/server:2017-latest

/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '365653wz' -Q 'RESTORE FILELISTONLY FROM DISK = "/var/opt/mssql/EIS_1293.bak"' | tr -s ' ' | cut -d ' ' -f 1-2

/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "365653wz" -Q 'RESTORE DATABASE EIS_1293 FROM DISK = "/var/opt/mssql/EIS_1293.bak"  WITH MOVE "EIS_411" TO "/var/opt/mssql/data/release_129x.mdf" , MOVE "EIS_411_log" TO "/var/opt/mssql/data/release_129x.ldf"'

I have tried adding the full permission to the folder, but it still does not work.

0 Answers
Related