Key takeaways Docker based SQL Server containers can be used today. SQL Server containers present a new option for support of development/test and continuous integration scenarios. SQL Server containers are created in seconds, and can support a team with isolated instances on a shared VM. windows (SQL Server) containers can drive VM consolidation. SQL Server containers can be applicable for both legacy and cloud-targeted applications.
In the Fall of 2014, Microsoft announced plans to add Docker container support to Windows Server 2016. The announcement added emphasis to Microsoft’s growing focus on linux and open source tooling. In the months that followed, .NET core was open sourced, Microsoft and Red Hat formed an alliance, and plans to port SQL Server to Linux were announced. Containers are just around the corner for the Windows community, so let’s take a closer look at the use of SQL Server containers.
Containers and Virtual MachinesContainers have been around for decades (remember BSD Jails in circa 2000), but have surged into the mainstream with adoption of Docker Inc’s open source project. Docker’s design includes an elegant method of application packaging and a server-side API for container management. The crux of the design is a method of application packaging that solves the “dependency hell” problem by incorporating software dependencies into a container image. Using Docker containers, a developer can be confident an application developed on a laptop will run on a shared test server, or in the public cloud.
Just as the Win32 API dominated the landscape for desktop applications, Docker is rapidly becoming the defacto industry standard API for container packaging. Microsoft is implementing a subset of the Docker API for Windows Server 2016, is involved in the standardization through the Open Container Initiative . Docker users benefit from industry-wide support with hosted services on AWS, Azure, and other clouds, and third party tools for monitoring, logging, cluster orchestration, and other services.
Containers are fast and lightweight and deliver improved resource utilization. Containers take seconds to launch, and typically present a small incremental workload for the host. It’s common to run scores of containers on a shared development or test server. VMs, on the other hand, can take minutes to launch, and often have low (10-15%) resource utilization. The popularity of containers for development and test is due to greater speed and agility in creating environments, as well as a significant reduction in the use (and maintenance) of VMs.
Containers, Images, and ReposContainers provide user and process isolation, to protect applications from poorly behaved neighbors. Both .NET and SQL Server containers also deliver effective name space isolation. There is a strong industry focus on enhancing container security, and the major cloud vendors (Azure and AWS) wrap container services in VMs to ensure secure use. Containers also include methods for managing resource usage, such as limiting CPU, disk, and network use.
Containers are built using a Dockerfile, which is a text file with a series of commands that are executed to build a container. Dockerfiles begin with a base image, and add code or data to the container. Containers can be saved and re-used as an “image.” Images are stored in a shared registry or repo.

Relational DB Containers and SQL Server
mysql and Postgres are among the most popular container images on the Docker Hub . Database containers are used to deliver identical, isolated, sandboxed environments for development and test. Data is included in the container or can be mounted. SQL Server containers are SQL Server instances based on Microsoft’s shared DLL architecture that has supported multiple SQL Server instances on a host for the past decade. Containers provide added process and user isolation, SQL Server configuration, and are accessible via SQL Management Studio and other tools. Once built, containers can be saved as Images, which are used to support teams with identical instances on a shared host. What makes containers uniquely helpful include:
Speed : SQL Server containers are provisioned in seconds and provide effective support for developers and testers, who often need to discard an instance and have it quickly replaced Efficiency : SQL Server containers run efficiently on a shared host, and support the consolidation of multiple VMs onto a single shared VM for dev and test teams, with corresponding license and operational savings CI/CD support : SQL Server containers provide automated support for adding and mounting databases, running configuration scripts at build time, and the support needed for automated build for Continuous Integration and Delivery processes HA/DR support : SQL Server containers support integration with third party systems for DB replication, snapshots, and mirroring, and significant work is being applied to prove their utility for a range of operational purposes. More on this below.Microsoft is poised to fulfill Docker support with Windows Server in the second half of 2016. Microsoft’s design features an option to support containers on either the Windows Server 2016 "core"or a headless server called Nano. Interestingly, Microsoft has been quiet regarding plans for SQL Server container support on Windows Server 2016, and earlier this spring chose to demo the first SQL Server container running on the future Linux port of SQL Server! This suggests that the SQL Server division may bypass Windows container support in favor of a future Linux host. This is understandable, given Microsoft’s choice to implement a Linux style of container or application configuration.
Microsoft’s Windows Server 2016 containers are designed to support a shell based container for .NET, Windows console apps and services. But, SQL Server and other Windows applications aren’t designed to be managed through a shell. SQL Server containers on Windows Server 2016 will require the use of SQL Management Studio, or other tools, to run scripts, or add or mount databases. Simply put, a SQL Server container that requires such manual steps defeats the speed and automation offered by containers.
Fortunately, developers interested in SQL Server containers based on a port of Docker’s open source aren’t limited to Microsoft’s implementation. WinDocks is a startup comprised of a group of former Microsoft engineers, who have released a port of Docker’s open source project for Windows 8, Windows 10, Windows Server 2012, and Windows Server 2016. WinDocks supports all editions of SQL Server 2008 (and r2), 2012, and 2014, and SQL Server 2016. WinDocks adds container support to Windows, enabling the use of SQL Server licenses with containers. A free WinDocks Community Edition is also available, and is the basis for this article.
Data Persistence and SQL Server ContainersWorking with SQL Server containers is no different from SQL Server instances, so the options include locally attached data or mounted databases. WinDocks SQL Server containers support the use of the ADDDB command to copy a database into the container, while the MOUNTDB command supports either local or network located databases.
The ADDDB copies databases (Primary, Secondary, and Log files) into a container, and are attached when the container is started and detached when stopped. SQL Server