Turn Windows 8.1 Into a Container Server
Turn Windows 8.1 Into a Container Server
Follow along to learn how to convert your Windows 8.1 machine into a Docker-fueled container server.
Join the DZone community and get the full member experience.Join For Free
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 Docker technology. Converting your Windows 8.1 machine to a Docker container server takes only 15 minutes, and 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 Docker Containers?
There's a lot of buzz about Docker containers, 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 the Docker engine support from WinDocks, 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 two- or four-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, it's possible to realize significant license savings! Most people estimate they can reduce the number of VMs used by a factor of three to five times.
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.
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. WinDocks also offers a Monthly Subscription license, so be sure you have the license key matched to the right WinDocks package (10, 25, and 50 container versions).
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.
The installation can take 10-20 minutes to complete, so have a cup of coffee ready.
The installation requires a reboot when complete, so plan accordingly.
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:
Open a second command prompt and enter the following to confirm a successful installation.
>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. Note that each container has a unique ContainerID and a port for access.
WinDocks is popular for support of the full Windows operating system family, and for SQL Server, something that is surprisingly missing from Microsoft's plans for Windows Server 2016. We've blogged on the difference between WinDocks containers and Microsoft's Docker implementation.
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 as well as a 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.
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 https://windocks.com/blog-2/Start-SQL-Server-Containers
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.
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.
Open a web browser to see the result. Note, the application includes the Port and SQL sa credentials from the edited web.cfg file.
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:
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).
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.
Opinions expressed by DZone contributors are their own.