{"id":18781,"date":"2015-08-19T16:58:41","date_gmt":"2015-08-19T15:58:41","guid":{"rendered":"https:\/\/aidanfinn.com\/?p=18781"},"modified":"2015-08-20T14:47:07","modified_gmt":"2015-08-20T13:47:07","slug":"introducing-windows-server-containers","status":"publish","type":"post","link":"https:\/\/aidanfinn.com\/?p=18781","title":{"rendered":"Introducing Windows Server Containers"},"content":{"rendered":"<p>Technical Preview 3 of Windows Server 2016 is out and one of the headline feature additions to this build is Windows Server Containers. What are they? And how do they work? Why would you use them?<\/p>\n<h2>Background<\/h2>\n<p>Windows Server Containers is Microsoft\u2019s implementation of an open source world technology that has been made famous by a company called Docker. In fact:<\/p>\n<ul>\n<li>Microsoft\u2019s work is a result of a partnership with Docker, one which was described to me as being \u201cone of the fastest negotiated partnerships\u201d and one that has had encouragement from CEO Satya Nadella.<\/li>\n<li>Windows Server Containers will be compatible with Linux containers.<\/li>\n<li>You can manage Windows Server Containers using Docker, which has a <a href=\"https:\/\/docs.docker.com\/windows\/step_one\/\">Windows command line client<\/a>. Don\u2019t worry \u2013 you won\u2019t have to go down this route if you don\u2019t want to install horrid prerequisites such as Oracle VirtualBox (!!!).<\/li>\n<\/ul>\n<h2>What are Containers?<\/h2>\n<p>Containers is around a while, but most of us that live outside of the Linux DevOps world won\u2019t have had any interaction with them. The technology is a new kind of virtualisation to enable rapid (near instant) deployment of applications.<\/p>\n<p>Like most virtualisation, Containers take advantage of the fact that most machines are over-resourced; we over-spec a machine, install software, and then the machine is under-utilized. 15 years ago, lots of people attempted to install more than one application per server. That bad idea usually ended up in p45\u2019s (\u201cpink slips\u201d) being handed out (otherwise known as a \u201ccareer ending event\u201d. That because complex applications make poor neighbours on a single operating system with no inter-app isolation.<\/p>\n<p>Machine virtualisation (vSphere, Hyper-V, etc) takes these big machines and uses software to carve the physical hosts into lots of virtual machines; each virtual machine has its own guest OS and this isolation provides a great place to install applications. The positives are we have rock solid boundaries, including security, between the VMs, but we have more OSs to manage. We can quickly provision a VM from a template, but then we have to install lots of pre-reqs and install the app afterwards. OK \u2013 we can have VM templates of various configs, but a hundred templates later, we have a very full library with lots of guest OSs that need to be managed, updated, etc.<\/p>\n<p>Containers is a kind of virtualisation that resides one layer higher; it\u2019s referred to as OS virtualization. The idea is that we provision a container on a machine (physical or virtual). The container is given a share of CPU, RAM, and a network connection. Into this container we can deploy a container OS image. And then onto that OS image we can install perquisites and an application. Here\u2019s the cool bit: everything is really quick (typing the command takes longer than the deployment) and you can easily capture images to a repository.<\/p>\n<p>How easy is it? It\u2019s very easy \u2013 I recently got hands-on access to Windows Server Containers in a supervised lab and I was able to deploy and image stuff using a PowerShell module without any documentation and with very little assistance. It had helped that I\u2019d watched a <a href=\"https:\/\/channel9.msdn.com\/Events\/Ignite\/2015\/BRK2493\">session on Containers from Microsoft Ignite<\/a>.<\/p>\n<h4>How Do Containers Work?<\/h4>\n<p>There are a few terms you should get to know:<\/p>\n<ul>\n<li><b>Windows Server Container<\/b>: The Windows Server implementation of containers. It provides application isolation via OS virtualisation, but it does not create a security boundary between applications on the same host. Containers are stateless, so stateful data is stored elsewhere, e.g. SMB 3.0.<\/li>\n<li><b>Hyper-V Container<\/b>: This is a variation of the technology that uses Hyper-V virtualization to securely isolate containers from each other \u2013 this is why nested virtualisation was added to WS2016 Hyper-V.<\/li>\n<li><b>Container OS Image<\/b>: This is the OS that runs in the container.<\/li>\n<li><b>Container Image<\/b>: Customisations of a container (installing runtimes, services, etc) can be saved off for later reuse. This is the mechanism that makes containers so powerful.<\/li>\n<li><b>Repository<\/b>: This is a flat file structure that contains container OS images and container images.<\/li>\n<\/ul>\n<p><i>Note: This is a high level concept post and is not a step-by-step instructional guide.<\/i><\/p>\n<p>We start off with:<\/p>\n<ul>\n<li><b>A container host<\/b>: This machine will run containers. Note that a Hyper-V virtual switch is created to share the host\u2019s network connection with containers, thus network-enabling those containers when they run.<\/li>\n<li><b>A repository<\/b>: Here we store container OS images and container images. This repository can be local (in TPv3) or can be an\u00a0SMB 3.0 file share (not in TPv3, but hopefully in a later release).<\/li>\n<\/ul>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb.png\" alt=\"image\" width=\"500\" height=\"154\" border=\"0\" \/><\/a><\/p>\n<p>The first step is to create a container. This is accomplished, natively, using a Containers PowerShell module, which from experience, is pretty logically laid out and easy to use. Alternatively you can use Docker. I guess System Center will add support too.<\/p>\n<p>When you create the container you specify the name and can offer a few more details such as network connection to the host\u2019s virtual switch (you can add this retrospectively), RAM and CPU.<\/p>\n<p>You then have a blank and useless container. To make it useful you need to add a container OS image. This is retrieved from the Repository, which can be local (in a lab) or on an SMB 3.0 file share (real world). Note that an OS is not installed in the container. The container points at the repository and only differences are saved locally.<\/p>\n<p>How long does it take to deploy the container OS image? You type the command, press return, and the OS is sitting there, waiting for you to start the container. Folks, Windows Server Containers are FAST &#8211; they are Vin Diesel parachuting a car from a plane fast.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb1.png\" alt=\"image\" width=\"500\" height=\"183\" border=\"0\" \/><\/a><\/p>\n<p>Now you can use Enter-PSSession to log into a container using PowerShell and start installing and configuring stuff.<\/p>\n<p>Let\u2019s say you want to install PHP. You need to:<\/p>\n<ol>\n<li>Get the installer available to the container, maybe via the network<\/li>\n<li>Ensure that the installer either works silently (unattended) or works from command line<\/li>\n<\/ol>\n<p>Install the program, e.g. PHP, and then configure it the way you want it (from command line).<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb2.png\" alt=\"image\" width=\"500\" height=\"183\" border=\"0\" \/><\/a><\/p>\n<p>Great, we now have PHP in the container. But there\u2019s a good chance that I\u2019ll need PHP in lots of future containers. We can create a container image from that PHP install. This process will capture the changes from the container as it was last deployed (the PHP install) and save those changes to the repository as a container image. The very quick process is:<\/p>\n<ol>\n<li>Stop the container<\/li>\n<li>Capture the container image<\/li>\n<\/ol>\n<p>Note that container image now has a link to the guest OS image that it was installed on, i.e. there is a dependency link and I\u2019ll come back to this.<\/p>\n<p>Let\u2019s deploy another container with a guest OS image called Container2.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb3.png\" alt=\"image\" width=\"500\" height=\"252\" border=\"0\" \/><\/a><\/p>\n<p>For some insane reason, I want to install the malware gateway known as Java into this container.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb4.png\" alt=\"image\" width=\"500\" height=\"254\" border=\"0\" \/><\/a><\/p>\n<p>Once again, I can shut down this new container and create a container image from this Java installation. This new container image also has a link to the required container OS image.<\/p>\n<p align=\"center\"><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb5.png\" alt=\"image\" width=\"500\" height=\"256\" border=\"0\" \/><\/a><\/p>\n<p>Right, let\u2019s remove Container1 and Container2 \u2013 something that takes seconds. I now have a container OS image for Windows Server 2012 R2 and container images for Java and Linux. Let\u2019s imagine that a developer needs to deploy an application that requires PHP. What do they need to do? It\u2019s quite easy \u2013 they create a container from the PHP container image. Windows Server Containers knows that PHP requires the Windows Server container OS image, and that is deployed too.<\/p>\n<p>The entire deployment is near instant because nothing is deployed; the container links to the images in the repository and saves changes locally.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb6.png\" alt=\"image\" width=\"500\" height=\"208\" border=\"0\" \/><\/a><\/p>\n<p>Think about this for a second \u2013 we\u2019ve just deployed a configured OS in little more time than it takes to type a command. We\u2019ve also modelled a fairly simple application dependency. Let\u2019s complicate things.<\/p>\n<p>The developer installs WordPress into the new container.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image7.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb7.png\" alt=\"image\" width=\"500\" height=\"208\" border=\"0\" \/><\/a><\/p>\n<p>The dev plans on creating multiple copies of their application (dev, test, and production) and like many test\/dev environments, they need an easy way to reset, rebuild, and to spin up variations; there\u2019s nothing like containers for this sort of work. The dev shuts down Container3 and then creates a new container image. This process captures the changes since the last deployment and saves a container image in the repository \u2013 the WordPress installation. Note that this container doesn\u2019t include the contents of PHP or Windows Server but it does link to PHP and PHP links to Windows Server.<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image8.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb8.png\" alt=\"image\" width=\"500\" height=\"233\" border=\"0\" \/><\/a><\/p>\n<p>The dev is done and resets the environment. Now she wants to deploy 1 container for dev, 1 for test, and 1 for production. Simple! This requires 3 commands, each one that will create a new container from the WordPress container image, which logically uses the required PHP and PHP\u2019s required Windows Server.<\/p>\n<p>Nothing is actually deployed to the containers; each container links to the images in the repository and saves changes locally. Each container is isolated from the other to provide application stability (but not security \u2013 this is where Hyper-V Containers comes into play). And best of all \u2013 the dev has had the experience of:<\/p>\n<ul>\n<li>Saying \u201cI want three copies of WordPress\u201d<\/li>\n<li>Getting the OS and all WordPress pre-requisites<\/li>\n<li>Getting them instantly<\/li>\n<li>Getting 3 <b>identical<\/b> deployments<\/li>\n<\/ul>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image9.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/image_thumb9.png\" alt=\"image\" width=\"500\" height=\"235\" border=\"0\" \/><\/a><\/p>\n<p>From the administrator\u2019s perspective, they\u2019ve not had to be involved in the deployment, and the repository is pretty simple. There\u2019s no need for a VM with Windows Server, another with Windows Server &amp; PHP, and another with Windows Server, PHP &amp; WordPress. Instead, there is an image for Windows Server, and image for PHP and an image for WordPress, with links providing the dependencies.<\/p>\n<p>And yes, the repository is a flat file structure so there\u2019s no accidental DBA stuff to see here.<\/p>\n<h2>Why Would You Use Containers?<\/h2>\n<p>If you operate in the SME space then keep moving, and don\u2019t bother with Containers unless they\u2019re in an exam you need to pass to satisfy the HR drones. Containers are aimed at larger environments where there is application sprawl and repetitive installations.<\/p>\n<p>Is this similar to what SCVMM 2012 introduced with Server App-V and service templates? At a very high level, yes, but Windows Server Containers is easy to use and probably a heck of a lot more stable.<\/p>\n<p>Note that Containers are best suited for stateless workloads. If you want to save data then save it elsewhere, e.g. SMB 3.0. What about MySQL and SQL Server? Based on what was stated at Ignite, then there\u2019s a solution (or one in the works); they are probably using SMB 3.0 to save the databases outside of the container. This might require more digging, but I wonder if databases would really be a good fit for containers. And I wonder, much like with Azure VMs, if there will be a later revision that brings us stateful containers.<\/p>\n<p>I don\u2019t imagine that my market at work (SMEs) will use Windows Server Containers, but if I was back working as an admin in a large enterprise then I would definitely start checking out this technology. If I worked in a software development environment then I would also check out containers for a way to rapidly provision new test and dev labs that are easy to deploy and space efficient.<\/p>\n<p>[Update]<\/p>\n<p>Here is a <a href=\"https:\/\/msdn.microsoft.com\/virtualization\/windowscontainers\/containers_welcome\" target=\"_blank\">link<\/a> to the Windows Server containers page on the TechNet Library.<\/p>\n<p>We won&#8217;t see Hyper-V containers in TPv3 &#8211; that will come in a later release, I believe later in 2015.<\/p>\n<div id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5d1ab824-694d-40fb-a173-fec0426da7c1\" class=\"wlWriterEditableSmartContent\" style=\"float: none; margin: 0px; display: inline; padding: 0px;\">Technorati Tags: <a href=\"http:\/\/technorati.com\/tags\/Windows+Server+2016\" rel=\"tag\">Windows Server 2016<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Virtualisation\" rel=\"tag\">Virtualisation<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Containers\" rel=\"tag\">Containers<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Technical Preview 3 of Windows Server 2016 is out and one of the headline feature additions to this build is Windows Server Containers. What are they? And how do they work? Why would you use them? Background Windows Server Containers is Microsoft\u2019s implementation of an open source world technology that has been made famous by &hellip; <a href=\"https:\/\/aidanfinn.com\/?p=18781\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Introducing Windows Server Containers&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":18783,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[52],"tags":[143,146,195,137],"class_list":["post-18781","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-server","tag-containers","tag-featured","tag-virtualisation","tag-windows-server-2016"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/08\/5939008153_270d7f65a6_z.jpg","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/18781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18781"}],"version-history":[{"count":6,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/18781\/revisions"}],"predecessor-version":[{"id":18797,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/18781\/revisions\/18797"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/media\/18783"}],"wp:attachment":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}