Server 2016 Container Basics
By Nick Taylor
Published October 5, 2016
Estimated Reading Time: 4 minutes

Hi again all!

With the recent announcement of Server 2016 going GA I decided it was finally time for me to start to understand containers.  The first thing I wanted to accomplish was to have a high level understanding of what a container was and why you would use them.  Below are a few very high level questions I went in with.

 

So what is a container?  

They are an isolated, resource controlled, and portable operating environment.

Basically, a container is an isolated place where an application can run without affecting the rest of the system, and without the system affecting the application. Containers are the next evolution in virtualization.

If you were inside a container, it would look very much like you were inside a freshly installed physical computer or a virtual machine. And, to Docker, a Windows container can be managed in the same way as any other container.

 

Why would a container be useful? 

One example would be with all of the applications dependencies deployed with it you can easily move the application through its dev/test/production lifecycle.  The entire time you can ensure the same builds of .Net or IIS patch levels are consistently used with it.

 

Is this different then virtualization? 

It can take the place of a hypervisor and you can run containers against bare metal hosts and the function of the bare metal would then be to run contains rather then VMs.  Containers also play well with virtualization so you can enable a VM to be a container host and then run containers inside of that and still keep the entire container farm highly available in your cluster.

 

So after having a very base understanding of what a container is I wanted to deploy a few in lab.  Microsoft has released several container images that you can download and configure once you have your Docker host configured.  All the links that I followed for setup will be posted below.

I decided to pull both the Windows Server Core and SQL Express Images from the catalog.

server-2016-container-basics-1

Once images are downloaded you can list what you have by running “docker images” command

server-2016-container-basics-2

Now that I have some containers local I can initialize them to run.  I’m working with the SQL Express image so I’m going to enter the following command.  I’m specifying what port for SQL to run under, the SA Password, and the image I want the container to reference.

“docker run -p 1433:1433 –env sa_password=Password1234 microsoft/mssql-server-2014-express-windows”

Once I do that I will see the image spin up and SQL Start within the newly created container

server-2016-container-basics-3

I can see all my running containers by running a “docker ps” command

server-2016-container-basics-4

You can see I have 4 instances of the SQL Express image running spanned out on a few different port numbers starting with the default 1433 for SQL.  Once up and running I can use SQL Server Management Studio to manage these instances.

server-2016-container-basics-5

As you can see from the screenshot I have 4 instances running and can create Databases in each.  I can also restart SQL by issuing a “docker restart CONTAINER ID <Container name>” command.  The databases and the specific instance data is persistent across restarts.

server-2016-container-basics-6

 

We can see my container now has only been started by again issuing a “docker ps” command and looking at the STATUS column.

server-2016-container-basics-7

From a host perspective I can see each of my SQL instances running in Task Manager

server-2016-container-basics-8

For my next blog post I want to be able to find a way to deploy SQLIO or Diskspd.exe that replaces SQLIO to the Docker images and benchmark the Docker Containers against fully deployed versions of the application against the running host.  I know it will be tough for you to CONTAIN yourself until that blog post.  Sorry I had to use at least one container pun…

 

Hopefully you found this useful and informative!  Its going to be a long road before I’m as comfortable in containers as I am VMs but my initial impressions are all positive.  I’m really glad to see these features baked into Server 2016 and finally be this close to running Nano Server as well!

 

Links to sources:

https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/

https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start

https://blogs.msdn.microsoft.com/jcorioland/2016/04/28/getting-started-with-containers-and-docker-on-windows-server-2016-technical-preview-5/

https://github.com/Microsoft/Virtualization-Documentation/issues/358 (if you don’t patch the OS before running your first container and you are seeing it hang here is the fix)

https://docs.docker.com/machine/get-started/

http://www.tomsitpro.com/articles/how-to-deploy-windows-server-docker-containers,1-3326.html

http://ezeeetm.github.io/Docker-Engine-for-Windows-Server-Walkthrough/

https://www.liquidweb.com/kb/how-to-list-and-attach-to-docker-containers/

https://github.com/Microsoft/sql-server-samples/tree/master/samples/manage/windows-containers/mssql-server-2014-express-windows

Post Tags: Containers
Article By Nick Taylor
Consultant – Model Technology Solutions Nick is an IT professional with more than 19 years of experience and a passion for learning about technology. His areas of expertise include datacenter, hypervisors, storage, network, cloud, and OSD. He spends his free time delving in crypto, video games, automation, IoT, and really anything nerdy.

Related Posts