Concepts

Turn Windows 8.1 into a Container Server

In this blog we take a look at how easy it is to turn any edition of Windows 8.1 into a Windows Container Server supporting .NET and SQL Server containers and the Docker API.


Windows Server 8 referred to what came to be known as Windows Server 2012. This blog does not pretend to turn a Windows 8 PC into Windows Server 2012. But, any Windows 8.1 machine can become a powerful Windows Container Server, providing full stack support for .NET and SQL Server using the latest in container technology.

Your enhanced Windows 8 machine will serve .NET and SQL Server containers in seconds, and should be capable of supporting a modest team with isolated container based environments. Not a bad capability for an old PC!

Why Windows Containers using Docker's Windows Client Software

There’s a lot of buzz about Docker, which is enjoying industry-wide support from AWS, Microsoft Azure and Windows Server 2016, Red Hat, and others. In this article we’re going to look at WinDocks port of Docker's open source project, which installs on Windows 8.1, Windows 10, Windows Server 2012, and Windows Server 2016. WinDocks includes support for .NET 4.5 and SQL Server containers, with support of all editions of SQL Server 2008 through 2016.

A 2 or 4 core laptop has plenty of capability to serve containers. A 2 core machine with 6 GB of RAM can support up to forty SQL Server 2012 containers! It takes roughly 20 seconds for an older machine to provision a new SQL Server container, but it’s faster, simpler, and lower-cost than VMs. Containers are ideal for short-lived instances used in development test.

Containers are more efficient and easily maintained than VMs. Most dev or test teams can use a shared server or VM, with identical, isolated containers, where previously multiple VMs were required. Maintenance is simplified, as the WinDocks host can be updated, and containers are refreshed with the updated host image.

And, given that Microsoft’s SQL Server licensing is by OS instance, or core, you can realize significant license savings! Most people estimate they can reduce the number of VMs used by a factor of 3-5x.

15 Minutes to Your Windows Container Server!

The WinDocks Installation is an automated package that will detect and install on any edition of Windows 8.1, Windows 10, Windows Server 2012, or Windows Server 2016.

1) WinDocks offers a free Community Editon, which is full featured but is limited in the number of containers, and limits the number of databases that can be added to the containers to one.

2) WinDocks configures SQL Server container support based on SQL Server instances installed on your machine. If you want SQL Server container support, be sure to install SQL Server prior to WinDocks.

3) The installation can take 10-20 minutes to complete, so have a cup of coffee ready

4) The installation requires a reboot of the machine when complete, so plan accordingly.

Starting WinDocks

Following the installation and reboot, open the Command Prompt as Administrator, and enter:


>docker -H=tcp://0.0.0.0:2375 –d

This starts the daemon and makes it available for both local and network use, at the standard Docker daemon port of 2375. If you’re simply going to work locally, the command can be shortened to:

>docker –d

Open a second Command Prompt and enter the following to confirm a successful installation.

>docker images
>docker run –d dotnet-4.5

The images command will list the base images provided with your install. We have both SQL Server 2012 and SQL Server 2014 installed on this Windows 8.1 machine, and see both images configured for containers.

Windows 8 Blog Image 1 650px

Using Containers

WinDocks is popular for support of the full Windows operating system family, and for SQL Server something that surprisingly missing from Microsoft’s plans for Windows Server 2016. We’ve blogged on the difference between WinDock containers and Microsoft’s Docker implementation here.

The most common use of containers is support of development and testing environments. We’ll begin by building a custom SQL Server container. Then we’ll integrate a .NET container with the SQL Server container, and launch the integrated environment.

A sample DockerFile will copy the adventureworks database into a container. We’ll save the container as a custom image, and then start a container based on the new image. By saving the container as a custom image, we can discard and replace the SQL Server container instance in seconds. Each container generates a unique ContainerID and Port. SQL Server containers can also include a SQL sa password (a configurable option). The “docker run –d” command creates and starts the new container.


Windows 8 Blog Image 2 650px

Note that we can work with a container with a unique subset of the ContainerID. Once started the container can be accessed with SQL Management Studio, and behaves like a normal SQL Server instance. The container adds additional user and process isolation, and automation of container database operations such as ADDDB (used in the DockerFile above). For background on working with SQL Server containers, see this article.

Now that we have the SQL Server container created and running, we will use a sample .NET application located in the c:\windocks\samples\testdotnet folder. Open the web.cfg file using notepad, and edit the IP address of your host, and the port of the new SQL Server container, and sa password.


Windows 8 Blog Image 3 650px

Now, build and start the .Net container. It will refer to your SQL Server container, and the two containers will be a private, fully integrated environment.

Windows 8 Blog Image 4 650px

Open a web browser to see the result. Note, the application includes the Port and SQL sa credentials from the edited web.cfg file.

Windows 8 Blog Image 5 650px

Docker clients for Mac, Linux, and Windows

To use this new Server over a network, download additional WinDocks compatible clients for Mac, Linux and Windows at:

 

Mac: https://get.docker.com/builds/Darwin/x86_64/docker-1.7.0

Windows: https://get.docker.com/builds/Windows/x86_64/docker-1.7.0.exe

Linux: https://get.docker.com/builds/Linux/x86_64/docker-1.7.0

The Windows Container host needs to be accessible via the network, and ports opened for Docker clients (port 2375), and for SQL Server (port 1433), and for the containers (range 10000 to 10200).

Next Steps:

Containers are easy to work with, and only require a handful of Docker commands. They are a great step forward from VMs, and particularly for agile support of SQL Server environments. Join thousands who are already getting up to speed on Windows containers by downloading your own copy of the WinDocks Community Edition.

Download your copy of the Community Edition at here

Similar posts

Get notified on new test data management insights

Be the first to know about new insights on DevOps and automation in the test data management space.