Can You ‘Contain’ Your Excitement About Windows Server Containers?

As Microsoft continues to work on the next release of Windows Server (unofficially called Windows Server 2016?), various new features are announced. Today we’re going to explore the new Windows Server Containers feature.

 

Reference Material

First off, here are some links to reference material on Windows Containers.

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

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

http://blogs.technet.com/b/server-cloud/archive/2015/04/08/microsoft-announces-new-container-technologies-for-the-next-generation-cloud.aspx

 

Setup/Installation

We’re going to follow the steps laid out in this TechNet article: https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/container_setup

Notice, however, that the article mentions doing this from a Windows Server 2016 Technical Preview environment, whereas I am running this on my Hyper-V host with Windows Server 2012 R2.

So there are 3 ways that we can start to use Containers, by installing the server Feature, by using the PowerShell script provided by Microsoft, or through the Azure Gallery.

 

Containers Host – Manual

To install the Containers feature manually is straight forward.

You need to start with a server running Windows Server 2016 Technical Preview 3. Note that this does not necessarily mean that your physical host needs to be running Windows Server 2016 TP3. In my example, I am running TP3 from a VM on my Windows Server 2012 R2 host.

Also note that your server (physical host or VM) is not required to be joined to a domain. This is good, since Developers will be able to use Containers for their development, running VMs on their own workstations (i.e. if they are using Windows 8/10 with client Hyper-V).

First start by launching the Add Roles and Features from Windows Server Manager.

Add Roles and Features

Continue through the wizard until you get to the Features section. Find “Containers” and select it.

Features - Containers

Continue to click Next, and complete the installation of this feature. You will probably have to restart the server after the feature is installed.

To check that it has been installed, you can always run the following PowerShell command: Get-Command -Module Containers to see all of the commands available.

Container PowerShell Commands

But is that it? Can we now create/use containers? Not quite.

Even though we’ve installed the Containers server feature, we still need a Container OS Base Image to work with. Microsoft has provided a PowerShell script to help get this setup for you.

Per this TechNet article (https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/inplace_setup), you can download the PowerShell script manually, and copy it to the server that you want to configure as a Container Host.

Note that your Container Host will require Internet access for this script to work correctly, as it downloads the Container OS Base Image from Microsoft’s repository.

Notice that the script shows “Feature Containers is already enabled” because we already did that part our selves. But there is a bunch of other stuff that it does for us (i.e. container networking, container OS image, Docker, etc.).

ContainerSetup Script Complete

If you follow this process, you will end up with a Container Host, but running on GUI-enabled system. As apposed to use the full-PowerShell method (described in the next section), which results in a Server Core OS installation.

 

Containers Host – PowerShell

If you don’t want to go through the manual setup process, you can use the PowerShell script provided by Microsoft to setup a Container Host quickly.

On your host launch an Administrative PowerShell console.

Then you can running the following command from Microsoft: wget -uri https://aka.ms/newcontainerhost -OutFile New-ContainerHost.ps1

Note that this PowerShell script is different than the one mentioned in the previous section. This one will create a Virtual Machine, complete with Windows Server 2016 TP3 Core, and configured with the Containers feature; hence the “Host” part in the script name.

Once you have downloaded the Container Host script, per the TechNet article, you can run the following command to start the automated build/deploy of the Container Host VM.

.\New-ContainerHost.ps1 –VmName <containerhost> -Password <password>

You will encounter a warning, which you need to type “y” (for Yes) to, and then hit enter.

PowerShell Command Prompt

As of the time of this writing, the process shows that the file is 6 GB in size; so factor that in when you are starting it, as it can take some time to download.

When it finishes downloading, it will continue with the rest of the configuration automatically.

ContainerHost Script Complete

When the process is complete, and you connect to the newly created Container Host, you will have to enter the password that you supplied at the beginning.

ContainerHost-PS Login

If you launch PowerShell, you can use the Get-WindowsFeature command, and you’ll notice that there are some features that are marked as “Removed”.

ContainerHost-PS - Removed Features

Included in this list is the “User Interface and Infrastructure” components. Therefore, if you for whatever reason need/want a GUI for your Container Host, you will need to follow the “Manual” process that I’ve detailed in the section previously.

ContainerHost-PS - Removed Features - User Interface

But what if you don’t want to use on-prem? You can always use Azure.

 

Containers Host – Azure

To setup a Container Host in Azure is very easy.

Microsoft already has a Gallery Image specific to Container Hosts. Instead of just repeating the information, here’s the link to the TechNet article (which also has a lot of screenshots): https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/azure_setup.

However, it is good to note that the resulting Containers Host in Azure (using the Gallery item), is a Server Core OS, and does not have a GUI. So again, if you do require a GUI interface, you will need to follow the Manual process and run the designated PowerShell script on a VM after you’ve installed the Containers feature.

 

Conclusion

Containers are the next thing in virtualization. If you want to read an excellent article that helps put Containers into perspective, I highly recommend Containers: Docker, Windows and Trends by Mark Russinovich.

%d bloggers like this: