Configure Windows Server Containers on a Local System

Setup/Installation

Currently there are 3 ways that containers and be utilized.

Containers Host – Manual

To install the Containers feature manually is straight forward.

  1. Setup a Windows Server 2016 Technical Preview 3 installationNOTE: 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
  3. Add Roles and Features
  4. Continue through the wizard until you get to the Features section
  5. Find Containers and select it
  6. Features - Containers
  7. Continue to click Next, and complete the installation of this feature
  8. Restart the server after the feature is installed
  9. 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
  10. 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.ps1NOTE: 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
  5. PowerShell Command Prompt
  6. NOTE: The process shows that the file is 6 GB in size as of the time of this writing.
  7. The rest of the configuration will begin automatically once the download completes
  8. ContainerHost Script Complete
  9. Once completed, connect to the newly created Container Host via the password supplied at the beginning of the processContainerHost-PS Login
  10. Launch PowerShell and use the Get-WindowsFeature command to notice some features that are marked as RemovedContainerHost-PS - Removed Features
  11. 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
  12. 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.