Compartilhar via


SQL Server 2016 Developer Edition in Windows Containers

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!

Thanks,
Perry Skountrianos
twitter | LinkedIn

Comments

  • Anonymous
    February 21, 2017
    Do we have a container for management and data tools yet?
    • Anonymous
      February 21, 2017
      Thanks for your comment RichB!We do not have a container for management and data tools yet - We are still trying to figure out how something like that should look like. In the meantime, the best alternative is installing tools (E.g. SSMS, SSDT etc.) on the host.We'd love to get your thoughts though, so please let us know of any ideas that you might have (E.g. specific tools etc.) or of any interesting offerings from other providers that you really like.Thanks,Perry
  • Anonymous
    February 22, 2017
    Any chance of a trace flag or similar to make the Developer Edition behave like Standard Edition so that reliable performance tests can be carried out ? Should be much less work now that Enterprise and Standard edition support the same programmability features.This request has been in connect since at least 2014 :-https://connect.microsoft.com/SQLServer/Feedback/Details/813447 well 2011 & possibly earlierhttps://connect.microsoft.com/SQLServer/Feedback/Details/664953
    • Anonymous
      February 22, 2017
      Thanks Stephen, I will resurface these connect items to the right folks as this is not Windows Container specific.
  • Anonymous
    February 22, 2017
    Do you have ENV variables that can be set to have the data get persisted to volumes external to the container
    • Anonymous
      February 22, 2017
      Hi John - We do not have an ENV variable that can be set to have the data persisted on the host. You can achieve this by using the docker -v flag. Here is any example that maps the C:/SQL container folder to the D:/SQL host folder:docker run -d -p 1433:1433 -v D:/SQL/:C:/SQL/ -e sa_password= -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developerFor issues with or questions about this image, please contact us through a GitHub issue: https://github.com/Microsoft/mssql-docker/issues so we can better triage.
      • Anonymous
        February 23, 2017
        Cool stuff. Related , I assume that you could also persist data (mdf / ldf) to blob storage too as currently already supported ? My rationale thinking even though dev /test, u might want to keep data outside of the VM / host - so u can trash VM / container and still have data / separation of Data / Compute pattern
        • Anonymous
          February 24, 2017
          Absolutely Andy! I have not tried that scenario yet but I plan on giving it a try and see how it works soon.
  • Anonymous
    March 07, 2017
    This one great and works on my Windows 10 pro. Following are the commands,1) docker run -d -p 1433:1433 -e sa_password=myPassword@12 --isolation=hyperv -e ACCEPT_EULA=Y microsoft/mssql-server-windows-developer2) docker ps ac15089a6d76 3) docker exec -it ac15089a6d76 powershell
  • Anonymous
    May 29, 2017
    This is so cool. I can use SQL Server 2016 Developer Edition on a client workstation that I cannot install it on natively (Windows 7 not supported) for development purposes without provisioning a server! Brilliant
  • Anonymous
    August 22, 2017
    This works great for connecting as 'sa' or Sql auth but our app connects with Windows auth and keeps us from being able to use it in QA scenarios.