1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00
Files
sql-server-samples/samples/manage/windows-containers/mssql-server-2014-express-windows
Perry Skountrianos - MSFT 84331a7d79 Update readme.md
2016-08-30 11:35:56 -07:00
..
2016-06-21 18:26:27 -07:00
2016-08-30 11:35:56 -07:00
2016-06-22 11:00:43 +02:00

mssql-server-2014-express-windows

This Dockerfile helps developers to get started using SQL Server 2014 Express in Windows Server Core Containers. The file downloads and installs SQL Server 2014 Express with the default setup parameters.

Note: This dockerfile is based on Buc Rogers' work that can be found [here] (https://github.com/brogersyh/Dockerfiles-for-windows/tree/master/sqlexpress)

Contents

About this sample
Before you begin
Run this sample
Sample details
Disclaimers
Related links

About this sample

  1. Applies to: SQL Server 2014 Express, Windows Server Technical Preview 4 or later
  2. Authors: Perry Skountrianos [perrysk-msft], Max Knor [knom]

Before you begin

To run this sample, you need the following prerequisites.

Software prerequisites:

You can run the container with the following command. (Note the you'll need Windows Server Core TP5 v10.0.14300.1030.)

docker run -p 1433:1433 -v C:/temp/:C:/temp/ --env sa_password=<YOUR SA PASSWORD> --env attach_dbs="<DB-JSON-CONFIG>" microsoft/mssql-server-2014-express-windows
  • -p HostPort:containerPort is for port-mapping a container network port to a host port.

  • -v HostPath:containerPath is for mounting a folder from the host inside the container.

    This can be used for saving database outside of the container.

  • -it can be used to show the verbose output of the SQL startup script.

    Use this to debug the container in case of issues.

Run this sample

The image provides two environment variables to optionally set:

  • sa_password: Sets the sa password and enables the sa login

  • attach_dbs: The configuration for attaching custom DBs (.mdf, .ldf files).

    This should be a JSON string, in the following format (note the use of SINGLE quotes!)

    [
      {
      	'dbName': 'MaxDb',
      	'dbFiles': ['C:\\temp\\maxtest.mdf',
      	'C:\\temp\\maxtest_log.ldf']
      },
      {
      	'dbName': 'PerryDb',
      	'dbFiles': ['C:\\temp\\perrytest.mdf',
      	'C:\\temp\\perrytest_log.ldf']
      }
    ]
    

    This is an array of databases, which can have zero to N databases.

    Each consisting of:

    • dbName: The name of the database

    • dbFiles: An array of one or many absolute paths to the .MDF and .LDF files.

      Note: The path has double backslashes for escaping! The path refers to files within the container. So make sure to include them in the image or mount them via -v!

This example shows all parameters in action:

docker run -p 1433:1433 -v C:/temp/:C:/temp/ --env attach_dbs="[{'dbName':'MaxTest','dbFiles':['C:\\temp\\maxtest.mdf','C:\\temp\\maxtest_log.
ldf']}]" microsoft/mssql-server-2014-express-windows

Sample details

The Dockerfile downloads and installs SQL Server 2014 Express with the following default setup parameters that could be changed (if needed) after the image is installed.

  • Collation: SQL_Latin1_General_CP1_CI_AS
  • SQL Instance Name: SQLEXPRESS
  • Root Directory: C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL
  • Language: English (United Stated)

Disclaimers

The code included in this sample is not intended to be a set of best practices on how to build scalable enterprise grade applications. This is beyond the scope of this quick start sample.

For more information, see these articles: