Microsoft Containers in Windows Server 2016Dzmitry Durasau
HelloSpeaker: Dzmitry Durasau
Microsoft Certified Trainer, MCSA, MCTS, MCPSolution Architect at EPAM Systems
Main areas of expertise: Cloud Infrastructures, Enterprise Windows-based IT, Virtualization and PowerShell.
• Containerization in Windows Server 2016• Windows Container Under the Hood• Hello, World!
Agenda
Containerization inWindows Server 2016
Containers – no magic insideJust another isolation technologyLike many others
• Remote Desktop Session• Application Virtualization• IIS Application Pool• Citrix• Thin Clients
Isolation Technologies
• Multiple containers run on a host with isolation provided through namespace and process isolation technologies.
Windows Server Containers
• Multiple containers run on a host, however each container is run inside of a utility virtual machine. This provides kernel level isolation between a Hyper-V container, the container host, and any other containers running on the container host.
Hyper-V Containers
Windows and Hyper-V Containers
Container Management Stack• PowerShe
ll• Docker
Compatibility• Windows Container can run only on
Windows Host• Windows Containers and Hyper-V
Containers are compatible • Docker Containers and PowerShell
Containers are not compatible• Docker Containert can be managed via
PowerShell in a restricted way (from TP4)
Containers Deployment
Operating System
Operating System
Physical System
VM
Container
Nested Virtualization in Windows Server 2016
Windows Containers in Azure
Windows Server 2012 || 14
Windows Container:Under the Hood
Installation• Containers• Hyper-V
Manage Containers with PowerShell
Windows Container Anatomy• Container Runtime• Container Image
Container RuntimeContainer Image (based on
WIM)
Windows Containers Image: WIM Package
Install WIM ImageInstall-ContainerOSImage
Container OS ImageC:\ProgramData\Microsoft\Windows\Images
Create ContainerNew-Container -Name <ContainerName> -ContainerImageName <ImageName>
Optional:-SwitchName <SwitchName>-MemoryStartupBytes
Containers
Containers Structure
Start Container
Start-Container –Name <ContainerName>
Container Start Procedure
Processes
CPU and RAM• 1 CPU per Container (not verified)• Startup RAM amount can be defined within
the container properties.
Manage ResourcesMemoryNetwork BandwidthCPU (Relative Weight)Storage IO (IOPS and Bandwidth)
Network• Windows Containers use Hyper-V Virtual
Host Network Adapter• Because Firewall is shared between
Container and OS the FW configuration should be performed in OS
• MAC Address is the same as OS.
Hyper-V Containers Anatomy
Hello, World!
Windows Container Restrictions• Windows Server Containers created with PowerShell
can not currently be managed with Docker and visa versa – Docker containers can be managed via PowerShell in TP4 in a restricted way (discovery, stop)
• Commands sporadically fail -- try again• Currently it is not possible to create a file share
within a Container - Fixed in TP4.• ASP.NET 4.5 and 3.5 doesn't run in a container –
Fixed in TP4• ASP 5.0 does work.• Windows Server Containers can be
managed/interacted with through a RDP session – removed in TP4
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/about/work_in_progress
DemoCreate new containerStart containerConnect to the container via PowerShellInstall IIS RoleCheck Web site via PowerShellCheck Web site via IE from hostExport container image
Demo Code#Review PowerShell cmdletsGet-Command -Module Containers
#Review Container ImagesGet-ContainerImage
#Because Containers use Hyper-V Virtual Switch we need to have at least one for network communicationsGet-VMSwitch
#Note: We can communicate with Containers even without network via PowerShell
#Let's create Container object $HelloWorld$HelloWorld = New-Container -Name "HelloWorld" -ContainerImageName WindowsServerCore -SwitchName Internal_Switch
#How they look:Get-Container
#Lets get the party started!Start-Container -Container $HelloWorld
#See container stateGet-Container
#Enter to the container with PowerShellEnter-PSSession -ContainerId $HelloWorld.ContainerId -RunAsAdministrator
#Install IISInstall-WindowsFeature -Name Web-Server
#Get Web SitesGet-IISSite
#Create Container ImageNew-ContainerImage -ContainerName $HelloWorld.Name -Publisher HDConf -Version 1.0 -Name HelloWorldHDConf
#Review our new containerGet-ContainerImage
#Export ContainerExport-ContainerImage -Name HelloWorldHDConf -Path c:\test\
Thank you!
• http://www.creationline.com/lab/11385• http://
blog.engineer-memo.com/2015/08/21/windows-server-containers
• http://blogs.msdn.com/b/msgulfcommunity/archive/2015/09/08/why-windows-server-containers-and-why-you-need-to-look-at-containers-hands-on.aspx
• https://msdn.microsoft.com/en-us/virtualization/windowscontainers/about/work_in_progress
• http://blogs.technet.com/b/rutechnews/archive/2015/09/16/24-171-windows-server-2016-techincal-preview-3-187.aspx
• https://www.techdays.ru/videos/10093.html• https://
channel9.msdn.com/Blogs/TechDays-Russia/Containers-in-Windows-Server-2016
Links and credits
Questions?Email: [email protected]:https://twitter.com/azuregeek Facebook:https://www.facebook.com/dzmitry.durasau
LinkedIn:https://www.linkedin.com/in/ddurasau
Dzmitry DurasauContainers in Windows Server
2016