We are excited to announce the public availability of SQL Server 2016 SP1 Developer Edition in Windows Containers! The image is now available on Docker Hub and the build scripts are hosted on our GitHub repository. This image can be used in both Windows Server Containers as well as Hyper-V Containers.
SQL Server 2016 Developer Edition: Docker Image | Installation Scripts
We hope you will find this image useful and leverage it for your container-based applications!
Why use SQL Server in containers?
SQL Server 2016 in a Windows container would be ideal when you want to:
- Quickly create and start a set of SQL Server instances for development or testing.
- Maximize density in test or production environments, especially in microservice architectures.
- Isolate and control applications in a multi-tenant infrastructure.
Prerequisites
Before you can get started with the SQL Server 2016 Developer Edition image, you’ll need a Windows Server 2016 or Windows 10 host with the latest updates, the Windows Container feature enabled, and the Docker engine.
Pulling and Running SQL Server 2016 in a Windows Container
Below are the Docker pull and run commands for running SQL Server 2016 Developer instance in a Windows Container. Make sure that the mandatory sa_password environment variable meets the SQL Server 2016 Password Complexity requirements.
First, pull the image
docker pull microsoft/mssql-server-windows-developer
Then, run a SQL Server container
• Running a Windows Server Container (Windows Server 2016 only)
docker run -d -p 1433:1433 -e sa_password= -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer
• Running a Hyper-V Container (Windows Server 2016 or Windows 10)
docker run -d -p 1433:1433 -e sa_password= ––isolation=hyperv -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer
Connecting to SQL Server 2016
From within the container
One of the ways to connect to the SQL Server instance from inside the container is by using the sqlcmd utility.
First, use the docker ps command to get the container ID that you want to connect to and use it to replace the parameter placeholder “DOCKER_CONTAINER_ID” in the commands below. You can use the docker exec -it command to create an interactive command prompt that will execute commands inside of the container by using either Windows or SQL Authentication.
• Windows authentication using container administrator account
docker exec -it "DOCKER_CONTAINER_ID" sqlcmd
• SQL authentication using the system administrator (SA) account
docker exec -it "DOCKER_CONTAINER_ID" sqlcmd -Usa
From outside the container
One of the ways to access SQL Server 2016 from outside the container is by installing SQL Server Management Studio (SSMS). You can install and use SSMS either on the host or on another machine that can remotely connect to the host. Please follow this blog post for detailed instructions on connecting to a SQL Server 2016 Windows Containers via SSMS.
SQL 2016 Features Supported on Windows Server Core
Please refer to this link for all SQL Server 2016 features that are supported on a Windows Server Core installation.
Further Reading
Windows Containers Documentation
Container Resource Management
MSSQL Docker GitHub Repo
Tutorials for SQL Server 2016
Please give the SQL Server 2016 Developer image a try, and let us know what you think!