我在Powershell和Docker for Windows(Windows 10 Pro)中使用以下命令
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:\下文 mvc_projects \ SAMPLEDB \ AdventureWorksDW2008R2_Log.ldf']}]” 微软/ MSSQL-服务器窗口
以下是错误
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.
答案 0 :(得分:0)
根据GitHub中发布的解决方案,设置ATTACH_DBs环境变量的最新开发人员和快速sqlserver图像工作正常。