Microsoft SQL Server Developer 2019 (including CU8) for Windows Containers
412
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
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.
docker run --name SQLServer -d -p 1433:1433 -e sa_password=<SA_PASSWORD> nielsvdc/mssql-server-windows-developer
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.
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"
]
}
]
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
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
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
Content type
Image
Digest
Size
3.4 GB
Last updated
over 5 years ago
docker pull nielsvdc/mssql-server-windows-developer