microsoft / sql-server-samples

Azure Data SQL Samples - Official Microsoft GitHub Repository containing code samples for SQL Server, Azure SQL, Azure Synapse, and Azure SQL Edge
Other
9.99k stars 8.86k forks source link

Parsing error for attach_dbs environment variable #159

Open cdossantos opened 7 years ago

cdossantos commented 7 years ago

Hello,

When I use the -e attach_dbs="my json string" I get: C:\Program Files\Docker\docker.exe: Error parsing reference: "–e" is not a valid repository/tag: invalid reference format. See 'C:\Program Files\Docker\docker.exe run --help'.

It seems that docker isn't understanding the "my json string" as a string and therefore -e isn't recognized as environment variable. I tried single quotes with same result.

Any ideas? Thank you in advance

Santos

perrysk-msft commented 7 years ago

Hi Santos -

Could you please paste the whole docker run command that you are using so we can troubleshoot further?

Below is an example that attaches a demo database from an .mdf and .ldf. Note that the demo.mdf and demo_log.ldf files (in the below example) need to be in the host location: D:\DATA\

docker run -d -p 1433:1433 -v D:\DATA\:"C:\SQL\DATA\" -e ACCEPT_EULA=Y -e attach_dbs="[{'dbName':'Demo','dbfiles':['C:\SQL\DATA\demo.mdf', 'C:\SQL\DATA\demo_log.ldf']}]" --env sa_password=Password1! microsoft/mssql-server-windows-express

Thanks, Perry

perrysk-msft commented 7 years ago

Hi Santos - Are you still having issues?

cdossantos commented 7 years ago

Hi,

I tested with something similar as your example and worked.

Thanks.