@@ -17,7 +17,7 @@ Note: This dockerfile is based on Buc Rogers' work that can be found [here] (htt
17
17
## About this sample
18
18
19
19
1 . ** Applies to:** SQL Server 2014 Express, Windows Server Technical Preview 4 or later
20
- 5 . ** Authors:** Perry Skountrianos [ perrysk-msft]
20
+ 5 . ** Authors:** Perry Skountrianos [ perrysk-msft] , Max Knor [ knom ]
21
21
22
22
<a name =before-you-begin ></a >
23
23
@@ -27,16 +27,44 @@ To run this sample, you need the following prerequisites.
27
27
28
28
** Software prerequisites:**
29
29
30
- You can run the container with the following command. Note the you'll need Windows Server Core TP5 v10.0.14300.1000.
31
- docker run -p 1433:1433 --env sa_password=<YOUR SA PASSWORD > microsoft/mssql-server-2014-express-windows
30
+ You can run the container with the following command.
31
+ (Note the you'll need Windows Server Core TP5 v10.0.14300.1000.)
32
+
33
+ ````
34
+ docker run -p 1433:1433 -v C:/temp/:C:/temp/ --env sa_password=<YOUR SA PASSWORD> --env attach_dbs="<DB-JSON-CONFIG>" -v microsoft/mssql-server-2014-express-windows
35
+ ````
36
+
37
+ - ** -p HostPort: containerPort ** is for port-mapping a container network port to a host port.
38
+ - ** -v HostPath: containerPath ** is for mounting a folder from the host inside the container.
39
+
40
+ This can be used for saving database outside of the container.
32
41
33
42
<a name =run-this-sample ></a >
34
43
35
44
## Run this sample
36
45
37
- The image provides one environment variable to set the sa password : </br >
46
+ The image provides two environment variables to optionally set : </br >
38
47
- sa_password: Sets the sa password and enables the sa login
39
-
48
+ - attach_dbs: The configuration for attaching custom DBs (.mdf, .ldf files).
49
+
50
+ This should be a JSON string, formed like the following (note the SINGLE quotes and everything in one line):
51
+ ```
52
+ [{'dbName':'MaxDb','dbFiles':['C:\\temp\\maxtest.mdf','C:\\temp\\maxtest_log.
53
+ ldf']},{'dbName':'PerryDb','dbFiles':['C:\\temp\\perrytest.mdf','C:\\temp\\perrytest_log.
54
+ ldf']}]
55
+ ```
56
+ There can be zero to many databases in the array.
57
+ - dbName: The name of the database
58
+ - dbFiles: An array of absolute paths to the .MDF and .LDF files.
59
+
60
+ Can be one or many, note that the path has double backslashes for escaping!
61
+
62
+ This example shows all parameters in action:
63
+ ```
64
+ docker run -p 1433:1433 -v C:/temp/:C:/temp/ --env attach_dbs="[{'dbName':'MaxTest','dbFiles':['C:\\temp\\maxtest.mdf','C:\\temp\\maxtest_log.
65
+ ldf']}]" sqlexpr
66
+ ```
67
+
40
68
<a name =sample-details ></a >
41
69
42
70
## Sample details
0 commit comments