What is a Container ?
Containers are an isolated, resource controlled, and portable operating environment.
A container is an isolated place where an application can run without affecting the rest of the system and without the system affecting the application. Containers are the next evolution in virtualization.
When we enter to a container it feels the same as the freshly installed physical computer or a virtual machine.we can use Docker to manage the windows server containers too.
Windows Container Types
- Windows Server Containers
provide application isolation through process and namespace isolation technology. A Windows Server container shares the same kernel with the container host and all containers running on the host.
- Hyper-V Containers
expand on the isolation provided by Windows Server Containers by running each container in a highly optimized virtual machine. When using this configuration kernel of the container host is not shared with the Hyper-V Containers.

Let’s walk through the creation of the windows container in windows server 2016 TP4
In this I use Azure VMs to test this in azure we can deploy a virtual machine with windows server 2016 TP4 image in azure marketplace.If your using Hyper-V or any other platform to test this you have to create a windows server 2016 TP4 VM and configure that VM as this link.
- Get the container image
Get-ContainerImage
Container Images - Create a new container from existing container image
New-Container -Name mycontainer -ContainerImage $containerImage -SwitchName "Virtual Switch"
New container - Start the created container
Start-Container -Name mycontainer
Start container - Remote connect to container install IIS Web Role
Enter-PSSession -ContainerName mycontainer -RunAsAdministrator Install-WindowsFeature web-server
IIS Role Installation - Stop the container for container image creation
Stop-Container -Name mycontainer
- Create new container image include IIS Web Role
New-ContainerImage -Container $container -Name IISImage -Publisher Demo -Version 1.0.0
Create IIS Container Image Container Images - Create new container using IIS container image
New-Container -Name IIS -ContainerImage $containerImage -SwitchName 'Virtual Switch' -Verbose
IIS enable container - Start the IIS enable container
Start-Container IIS
- Create NAT port mapping to access the IIS server enable container through container host
if (!(Get-NetNatStaticMapping | where {$_.ExternalPort -eq 80})) { Add-NetNatStaticMapping -NatName 'ContainerNat' -Protocol TCP -ExternalIPAddress 0.0.0.0 -InternalIPAddress 172.16.0.2 -InternalPort 80 -ExternalPort 80 }
NAT Port Mapping - Add a firewall rule at allow HTTP traffic to container from the container host
if (!(Get-NetFirewallRule | where {$_.Name -eq "TCP80"})) { New-NetFirewallRule -Name 'TCP80' -DisplayName 'HTTP on TCP/80' -Protocol tcp -LocalPort 80 -Action Allow -Enabled True }
Firewall Rule - Remote access to the container and modify the default IIS page
Enter-PSSession -ContainerName IIS -RunAsAdministrator del C:inetpubwwwrootiisstart.htm 'Hello World From other side to Windows Server Container' >C:inetpubwwwrootindex.html
Edit the default page - I used another Azure VM connect to same VNet to test the IIS server enter the IP address of the container host and you will see the edited default IIS page.
Note-If your using Azure VM make sure to allow inbound and outbound traffic for HTTP TCP Port 80 in NSG (Network Security Group)Default IIS Page
Additional Resources
Windows Containers Documentation
Windows Containers
Container Host Deployment – Windows Server