M6 - Lesson 2: Preparing for containers
Preparing for Nano Server
Preparing Windows Server host
1. Create a Nano Server virtual hard disk file for containers:
Prepare a Nano Server virtual hard disk file with the container and Hyper-V capabilities. This requires that you build a Nano Server image by using the -Compute and -Containers switches.
New-NanoServerImage -MediaPath $WindowsMedia -BasePath c:\nano -TargetPath
C:\nano\NanoContainer.vhdx -GuestDrivers -
ReverseForwarders -Compute -Containers
2. Prepare the Windows Server host
1. Install the container feature: This step enables the use of Windows Server and Hyper-V containers.
Install-WindowsFeature Containers
2. Create a virtual switch: All containers connect to a virtual switch for network communications.
New-VMSwitch -Name <Virtual Switch Name> -
SwitchType <Type>
3. Configure network address translation (NAT): If you want to use a virtual switch configured with NAT, you must configure the NAT settings.
4. Configure media access control (MAC) address spoofing: If your container host is virtualized, you must enable MAC address spoofing.
Get-VMNetworkAdapter -VMName <Container
Host VM> | Set-VMNetworkAdapter -
MacAddressSpoofing On
Preparing for Hyper-V containers
1. Install the container feature: This step enables the use of Windows Server and Hyper-V containers.
Install-WindowsFeature Containers
2. Enable the Hyper-V role
3. Enable nested virtualization: If your container host is a Hyper-V VM, you must enable nested virtualization.
Set-VMProcessor -<VMName Container Host VM> -
ExposeVirtualizationExtensions $true
4. Configure virtual processors: If the container host is a Hyper-V VM, you must configure at least two virtual processors.
6. Configure network address translation (NAT): If you want to use a virtual switch configured with NAT, you must configure the NAT settings.
5. Create a virtual switch: All containers connect to a virtual switch for network communications.
7. Configure media access control (MAC) address spoofing: If your container host is virtualized, you must enable MAC address spoofing.
Installing Package Providers
Install-PackageProvider –Name ContainerImage –Force
Deploying package providers
DockerMsftProvider: Package provider for discovering, installing, and updating Docker images
NuGet: Package provider for C# packages
ContainerImage: Package provider for discovering, downloading, and installing Windows container OS images
NanoServerPackage: Package provider for discovering, downloading, and installing Nano Server packages
PowerShellGet: Package provider for installing Windows PowerShell modules and scripts from the online gallery
WSAProvider: Package provider for discovering, installing, and inventorying Windows Server App (WSA) packages—a wrapper for APPX cmdlets
MyAlbum: Package provider for discovering photos in your remote file repository and installing them to your local folder