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.
Once images are downloaded you can list what you have by running “docker images” command
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
I can see all my running containers by running a “docker ps” command
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.
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.
We can see my container now has only been started by again issuing a “docker ps” command and looking at the STATUS column.
From a host perspective I can see each of my SQL instances running in Task Manager
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://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/