I’m using docker for windows on windows 10, and I’m running the below command in Powershell:
docker run -d -p 1433:1433 -e sa_password=Infra_2017 -e ACCEPT_EULA=Y -v
c:/infra_mvc_projects/SampleDb:c:/infra_mvc_projects/SampleDb -e
attach_dbs="[{'dbName':'AdventureWorksDW2008R2_Data','dbFiles':
['c:\infra_mvc_projects\SampleDb\AdventureWorksDW2008R2_Data.mdf','c:\infra mvc_projects\SampleDb\AdventureWorksDW2008R2_Log.ldf']}]" microsoft/mssql-server-windows
I get the following error:
VERBOSE: Starting SQL Server
docker : Sqlcmd: 'AdventureWorksDW2008R2_Data";CREATE DATABASE
"AdventureWorksDW2008R2_Data" ON (FILENAME =
N'c:\infra_mvc_projects\SampleDb\AdventureWorksDW2008R2_Data.mdf'),
(FILENAME =
N'c:\infra_mvc_projects\SampleDb\AdventureWorksDW2008R2_Log.ldf') FOR
ATTACH ;"': Unexpected
argument. Enter '-?' for help.
At line:1 char:1
+ docker logs 673
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Sqlcmd: 'Advent... '-?' for
help.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
VERBOSE: Changing SA login credentials
VERBOSE: Attaching 1 database(s)
VERBOSE: Invoke-Sqlcmd -Query sp_detach_db
"AdventureWorksDW2008R2_Data";CREATE
DATABASE "AdventureWorksDW2008R2_Data" ON (FILENAME =
N'c:\infra_mvc_projects\SampleDb\AdventureWorksDW2008R2_Data.mdf'),
(FILENAME =
N'c:\infra_mvc_projects\SampleDb\AdventureWorksDW2008R2_Log.ldf') FOR
ATTACH ;
VERBOSE: Started SQL Server.