Step-By-Step: Setup and Installation of Windows Server Containers

Various new features have been announced in Microsoft’s upcoming release of Windows Server 2016. This Step-By-Step post will explore the new Windows Server Containers feature made available in the upcoming release.  The following video provides a great overview of the feature:

 

Setup/Installation

Currently there are 3 ways that containers can be utilized.

Containers Host – Manual

To install the Containers feature manually is straight forward.

  1. Setup a Windows Server 2016 Technical Preview 3 installation

    NOTE: This does not necessarily mean that your physical host needs to be running Windows Server 2016 TP3. This post highlights TP3 running from a VM on a Windows Server 2012 R2 host. To add, the server (physical host or VM) is not required to be joined to a domain. This allows developers will be able to use containers for their development, running VMs on their own workstations.

  2. Launch the Add Roles and Features from Windows Server Manager

    Add Roles and Features

  3. Continue through the wizard until you get to the Features section

  4. Find Containers and select it

    Features - Containers

  5. Continue to click Next, and complete the installation of this feature

  6. Restart the server after the feature is installed

  7. Check to ensure the feature has been installed by running the following PowerShell command: Get-Command -Module Containers to see all of the commands available Container PowerShell Commands

Now that the Containers server feature has been installed, a Container OS Base Image is needed to work with. Microsoft has provided a PowerShell scriptto help get this setup for you.

NOTE: The 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

The PowerShell script provided by Microsoft to setup a Container Host quickly should the manual method not be desirable.

  1. On your host launch an Administrative PowerShell console

  2. Run the following PowerShell command: wget -uri https://aka.ms/newcontainerhost -OutFile New-ContainerHost.ps1

    NOTE: 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.

  3. Once the Container Host script is downloaded, run the following command to start the automated build/deploy of the Container Host VM

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

  4. Type y (for Yes) and then hit enter when the warning is encountered

    PowerShell Command Prompt

    NOTE: The process shows that the file is 6 GB in size as of the time of this writing.

  5. The rest of the configuration will begin automatically once the download completes ContainerHost Script Complete

  6. Once completed, connect to the newly created Container Host via the password supplied at the beginning of the process ContainerHost-PS Login

  7. Launch PowerShell and use the Get-WindowsFeature command to notice some features that are marked as Removed

    ContainerHost-PS - Removed Features

    NOTE: The User Interface and Infrastructure components are also removed. Follow the manual process above should there be a requirement for a GUI for your Container Host

    ContainerHost-PS - Removed Features - User Interface

Containers Host – Azure

The third method involves the setup of a Container Host in Azure.

Microsoft already offers a Gallery Image specific to Container Hosts and has provided a detailed overview as to how to enable it.

NOTE: The resulting Containers Host in Azure (using the Gallery item) utilizes a Server Core OS offering. Meaning it does not have a GUI. Follow the manual process above should there be a requirement for a GUI for your Container Host