Sign inSign up

nielsvdc/mssql-server-windows-developer

By nielsvdc

Updated over 5 years ago

Microsoft SQL Server Developer 2019 (including CU8) for Windows Containers

Image
0

412

nielsvdc/mssql-server-windows-developer repository overview

Microsoft SQL Server Developer 2019 (including CU8) for Windows Containers

Intended Use: Development and Testing only. Not supported in production environments.

If you are looking for the official Microsoft image for SQL Server Developer, go here

Requirements

This image is compatible with Windows Server 2016 (Core, with Desktop) and Windows 10 (Professional, Enterprise - Anniversary Edition) OS Hosts. Visit this link for the full list of Windows container requirements.

How to use this image

Start a basic mssql server instance
docker run --name SQLServer -d -p 1433:1433 -e sa_password=<SA_PASSWORD> nielsvdc/mssql-server-windows-developer
Connect to Microsoft SQL Server

You can connect to the SQL Server instance from inside the same container by using the sqlcmd utility, or from outside the container by downloading SQL Server Management Studio (SSMS). Follow this blog for detailed steps on how to connect to the SQL Server instance from inside or outside the container.

Environment Variables
  • sa_password: The system administrator (userid = 'sa') password used to connect to SQL Server once the container is running. The password must meet the password complexity requirements found here.

  • ACCEPT_EULA (optional parameter): Confirms acceptance of the end user licensing agreement found here. By default this is set to Yes.

  • attach_dbs (optional parameter): The configuration for attaching custom DBs (.mdf, .ldf files). The configuration is in single line JSON format. The following example shows all parameters in action and look further in this overview for an exmaple:

[
  {
    "dbName": "AdventureWorks2019",
    "dbFiles": [
      "C:\\SqlServer\\Data\\AdventureWorks2019.mdf",
      "C:\\SqlServer\\Log\\AdventureWorks2019_log.ldf"
    ]
  }
]
Start a basic mssql server instance with a secrets file

On your host computer in the default Docker folder (C:\ProgramData\Docker) create a folder secrets. In this folder create a new file named sa-password and store the system administrator password for SQL Server in this file. Now there is no need to add the password as an environment variable for the docker run command.

docker run --name SQLServer -d -p 1433:1433 nielsvdc/mssql-server-windows-developer
Start a mssql server instance and redirect data folder for persistent database files

With this example the folder C:\Docker\Volumes\SQLServer on the host computer is mounted to the C:\SqlServer folder in the container image, thus leaving the database files intact when removing the container:

docker run --name SQLServer -d -p 1433:1433 --volume C:\Docker\Volumes\SQLServer:C:\SqlServer -e sa_password=<SA_PASSWORD> nielsvdc/mssql-server-windows-developer
Start a mssql server instance and attach existing database files on the host computer

With this example we are starting the container with a redirected data folder and attaching existing database files. For attaching the existing database files we need to create a JSON formatted text string as below. With this file we attach the files for the AdventureWorks2019 and AdventureWorksDW2019 databases.

[
  {
    "dbName": "AdventureWorks2019",
    "dbFiles": [
      "C:\\SqlServer\\Data\\AdventureWorks2019.mdf",
      "C:\\SqlServer\\Log\\AdventureWorks2019_log.ldf"
    ]
  },
  {
    "dbName": "AdventureWorksDW2019",
    "dbFiles": [
      "C:\\SqlServer\\Data\\AdventureWorksDW2019.mdf",
      "C:\\SqlServer\\Log\\AdventureWorksDW2019_log.ldf"
    ]
  }
]

Note: It's important to use single quotes in the text string, or this will not work. Double quotes are eliminated by docker in the environment variables.

To run the container images, use the following command:

docker run --name SQLServer -d -p 1433:1433 --volume C:\Docker\Volumes\SQLServer:C:\SqlServer -e sa_password=<SA_PASSWORD> -e attach_dbs="[{'dbName':'AdventureWorks2019','dbFiles':['C:\\SqlServer\\Data\\AdventureWorks2019.mdf','C:\\SqlServer\\Log\\AdventureWorks2019_log.ldf']},{'dbName':'AdventureWorksDW2019','dbFiles':['C:\\SqlServer\\Data\\AdventureWorksDW2019.mdf','C:\\SqlServer\\Log\\AdventureWorksDW2019_log.ldf']}]" nielsvdc/mssql-server-windows-developer

Tag summary

Content type

Image

Digest

Size

3.4 GB

Last updated

over 5 years ago

docker pull nielsvdc/mssql-server-windows-developer