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.
- 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.
- Launch the Add Roles and Features from Windows Server Manager
- Continue through the wizard until you get to the Features section
- Find Containers and select it
- Continue to click Next, and complete the installation of this feature
- Restart the server after the feature is installed
- 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
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.).
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.
- On your host launch an Administrative PowerShell console
- 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.
- 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>
- Type y (for Yes) and then hit enter when the warning is encountered
- NOTE: The process shows that the file is 6 GB in size as of the time of this writing.
- The rest of the configuration will begin automatically once the download completes
- Once completed, connect to the newly created Container Host via the password supplied at the beginning of the process
- Launch PowerShell and use the Get-WindowsFeature command to notice some features that are marked as Removed
- 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
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.