Containers, Docker, Hyper-V, Nano Server, Server 2016

Windows Containers on Windows Server 2016

I am running these on Windows 10 Pro and I have got Hyper-V feature enabled. Created a few VMs on this hyper-v host.

Prerequisites: One computer system (physical or virtual) running Windows Server 2016.

Critical updates are needed in order for the Windows Container feature to function. Please install all updates before working through this tutorial.

To install Docker we’ll use the OneGet provider PowerShell module which works with providers to perform the installation, in this case the MicrosoftDockerProvider. The provider enables the containers feature on your machine. You also install Docker which requires a reboot. Docker is required in order to work with Windows containers. It consists of the Docker Engine and the Docker client.+

Fist I have enabled Containers Feature on my server going in to Add Roles and Features

Capture99

Capture

Then run a PowerShell command prompt as an administrator;

First, install the Docker-Microsoft PackageManagement Provider from the PowerShell Gallery.

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

Capture3

Secondly you use the PackageManagement PowerShell module to install the latest version of Docker.

Install-Package -Name docker -ProviderName DockerMsftProvider

Capture4

This indicates we need KB3176936 to be installed on my server. I will use Windows Updates to bring my server up-to-date.

Capture5

Capture6

Looks like we are good to carry on, I will run the same command one more time to see if it is going to run…

Capture7

All good so far. And run Restart-Computer -Force to restart to complete configurations.

Just to check the installed version….

Capture8

I downloaded a pre-created .NET sample image from the Docker Hub registry and deploy a simple container running a .Net Hello World application.

Use docker run to deploy the .Net container. This will also download the container image which may take a few minutes.

docker run microsoft/dotnet-samples:dotnetapp-nanoserver

Capture9

I had to start Docker service after my reboot otherwise I get the error in the image..

Start-Service Docker

Once all the downloads completed…..

Capture9F

There you have it.

Advertisements
Hyper-V, Nano Server, Server 2016

Roles and Features for a Nano Server

For Windows Server 2016, Nano Server is distributed on the physical media, where you will find a NanoServer folder; this contains a .wim image and a subfolder called Packages. It is these package files that you use to add server roles and features to the VHD image, which you then boot to.

folder

You can also find and install these packages with the the NanoServerPackage provider of PackageManagement (OneGet) PowerShell module.

packages

This table shows the roles and features that are available in this release of Nano Server, along with the Windows PowerShell options that will install the packages for them. Some packages are installed directly with their own Windows PowerShell switches (such as -Compute); others you install by passing package names to the -Package parameter, which you can combine in a comma-separated list. You can dynamically list available packages using the Get-NanoServerPackage cmdlet.

Role or feature Option
Hyper-V role (including NetQoS) -Compute
Failover Clustering and other components, detailed after this table -Clustering
Basic drivers for a variety of network adapters and storage controllers. This is the same set of drivers included in a Server Core installation of Windows Server 2016. -OEMDrivers
File Server role and other storage components, detailed after this table -Storage
Windows Defender, including a default signature file -Defender
Reverse forwarders for application compatibility, for example common application frameworks such as Ruby, Node.js, etc. Now included by default
DNS Server role -Package Microsoft-NanoServer-DNS-Package
PowerShell Desired State Configuration (DSC) -Package Microsoft-NanoServer-DSC-Package
Internet Information Server (IIS) -Package Microsoft-NanoServer-IIS-Package
Host support for Windows Containers -Containers
System Center Virtual Machine Manager agent -Package Microsoft-NanoServer-SCVMM-Package
-Package Microsoft-NanoServer-SCVMM-Compute-Package
Note: Use the SCVMM Compute package only if you are monitoring Hyper-V. For hyper-converged deployments in VMM, you should also specify the -Storage parameter.
System Center Operations Manager agent Installed separately.
Data Center Bridging (including DCBQoS) -Package Microsoft-NanoServer-DCB-Package
Deploying on a virtual machine -Package Microsoft-NanoServer-Guest-Package
Deploying on a physical machine – Package Microsoft-NanoServer-Host-Package
BitLocker, trusted platform module (TPM), volume encryption, platform identification, cryptography providers, and other functionality related to secure startup -Package Microsoft-NanoServer-SecureStartup-Package
Hyper-V support for Shielded VMs -Package Microsoft-NanoServer-ShieldedVM-Package
Note: This package is only available for the Datacenter edition of Nano Server.
Simple Network Management Protocol (SNMP) agent -Package Microsoft-NanoServer-SNMP-Agent-Package.cab
Note: Not included with Windows Server 2016 installation media. Available online only.
IPHelper service which provides tunnel connectivity using IPv6 transition technologies (6to4, ISATAP, Port Proxy, and Teredo), and IP-HTTPS -Package Microsoft-NanoServer-IPHelper-Service-Package.cab
Note: Not included with Windows Server 2016 installation media. Available online only.

Failover Clustering items installed by the -Clustering parameter

  • Failover Clustering role
  • VM Failover Clustering
  • Storage Spaces Direct (S2D)
  • Storage Quality of Service
  • Volume Replication Clustering
  • SMB Witness Service

File and storage items installed by the -Storage parameter

  • File Server role
  • Data Deduplication
  • Multipath I/O, including a driver for Microsoft Device-Specific Module (MSDSM)
  • ReFS (v1 and v2)
  • iSCSI Initiator (but not iSCSI Target)
  • Storage Replica
  • Storage Management Service with SMI-S support
  • SMB Witness Service
  • Dynamic Volumes
  • Basic Windows storage providers (for Windows Storage Management)

Examples;

Failover Clustering

Import-PackageProvider NanoServerPackage

find-NanoServerPackage -Name *

install-NanoServerPackage -name Microsoft-NanoServer-FailoverCluster-Package -culture en-us

DNS –

Import-PackageProvider NanoServerPackage

find-NanoServerPackage -Name *

install-NanoServerPackage -name Microsoft-NanoServer-DNS-Package -culture en-us

Enable-WindowsOptionalFeature -Online -FeatureName DNS-Server-Full-Role

 

Hyper-V –

Import-PackageProvider NanoServerPackage

find-NanoServerPackage -Name *

install-NanoServerPackage -name Microsoft-NanoServer-Compute-Package -culture en-us

Restart-computer

Hyper-V, Nano Server, Server 2016

How to deploy a Nano Server 2016

Nano Server is a remotely administered server operating system optimized for private clouds and datacenters. It is similar to Windows Server in Server Core mode, but significantly smaller, has no local logon capability, and only supports 64-bit applications, tools, and agents. It takes up far less disk space, sets up significantly faster, and requires far fewer updates and restarts than Windows Server. When it does restart, it restarts much faster. The Nano Server installation option is available for Standard and Datacenter editions of Windows Server 2016.

So let’s start, first of all, I have mounted my Server 2016 ISO file on to my desktop and copied the NanoServer folder on to my local drive.

NANO file

We have got a few things here that we will need to create our VHDX file for our VM.

Content

Start Windows PowerShell as an administrator, change directory to the folder where you have placed the NanoServer folder and then import the module with;

Import-Module .\NanoServerImageGenerator -Verbose

Nano1

As you see from the image you need to change your execution policy to run this command otherwise you will get error message like the one in the image.

Set-ExecutionPolicy RemoteSigned

This will allow us to run all the commandlets for nano server.

Next is to create our VHDX file.

New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath <path to root of media> -BasePath .\Base -TargetPath .\NanoServerVM\NanoServerVM.vhd -ComputerName <computer name>

Nano2

1

3

5

So, this creates a VHDX from an ISO mounted as I:\. When creating the VHDX it will use a folder called Base in the same directory where you ran New-NanoServerImage; it will place the VHDX (called NanoServer1.vhdx) in a folder called NanoServer in the folder from where the command is run. The computer name will be NanoServer1. The resulting VHDX will contain the Standard edition of Windows Server 2016 and will be suitable for Hyper-V virtual machine deployment. If you want a Generation 1 virtual machine, create a VHD image by specifying a .vhd extension for -TargetPath. For a Generation 2 virtual machine, create a VHDX image by specifying a .vhdx extension for -TargetPath. You can also directly generate a WIM file by specifying a .wim extension for -TargetPath.

What we see within our folder;

folder

Our final step is to use our Hyper-V Server to create a VM using thi VHDX file.

From hyper-v manager > create a virtual machine > starts with a wizard > Give a name and use the option “Use an existing virtual hard disk and locate the VHDX file we have just created. And finish the wizard.

create

You will see the first screen

firstScreen

Use the credentials you use to create this VM, you will be asked to change this password. Log on;

second screen

This is all you get; Configure the Networking and firewall rules for SMB and ICMP traffic ….

You can only manage this server remotely but you need to create a trust. Go to a member server and open up a PowerShell command;

Set-item wsman:\localhost\client\trustedhosts -value [IP address of your nano server]

trust

trust2

Then you can run

Enter-PSSession -ComputerName NanoServer1

Hyper-V, Server 2012 / R2, Server 2016, Virtualization

Hyper-V Integration Services

Hyper-V Integration Services allow a virtual machine to communicate with the Hyper-V host. Many of these services are conveniences, such as guest file copy, while others are important to the virtual machine’s ability to function correctly, such as time synchronization. This set of services are sometimes referred to as integration components,

integrationS

The Integration Services pane lists all integration services available on the Hyper-V host, and whether they’re turned on in the virtual machine. To get the version information for a guest operating system, log on to the guest operating system, open a command prompt, and run this command:

REG QUERY “HKLM\Software\Microsoft\Virtual Machine\Auto” /v IntegrationServicesVersion

PowerShell

Integration services

Name Windows Service Name Linux Daemon Name Description Impact on VM when disabled
Hyper-V Heartbeat Service vmicheartbeat hv_utils Reports that the virtual machine is running correctly. Varies
Hyper-V Guest Shutdown Service vmicshutdown hv_utils Allows the host to trigger virtual machines shutdown. High
Hyper-V Time Synchronization Service vmictimesync hv_utils Synchronizes the virtual machine’s clock with the host computer’s clock. High
Hyper-V Data Exchange Service (KVP) vmickvpexchange hv_kvp_daemon Provides a way to exchange basic metadata b etween the virtual machine and the host. Medium
Hyper-V Volume Shadow Copy Requestor vmicvss hv_vss_daemon Allows Volume Shadow Copy Service to back up the virtual machine with out shutting it down. Varies
Hyper-V Guest Service Interface vmicguestinterface hv_fcopy_daemon Provides an interface for the Hyper-V host to copy files to or from the virtual machine. Low
Hyper-V PowerShell Direct Service vmicvmsession not available Provides a way to manage virtual machine with PowerShell without a network connection. Low

Use Windows PowerShell to turn a integration service on or off

To do this in PowerShell, use Enable-VMIntegrationService and Disable-VMIntegrationService.

Get-VMIntegrationService -VMName “TestVM”

VMName Name Enabled PrimaryStatusDescription SecondaryStatusDescription
—— —- ——- ———————— ————————–
TestVM Guest Service Interface      False OK
TestVM Heartbeat                              True OK                                 OK
TestVM Key-Value Pair Exchange   True OK
TestVM Shutdown                              True OK
TestVM Time Synchronization        True OK
TestVM VSS                                          True OK

                                    Services Overview

Hyper-V Guest Shutdown Service

Windows Service Name: vmicshutdown
Linux Daemon Name: hv_utils
Description: Allows the Hyper-V host to request that the virtual machine shutdown. The host can always force the virtual machine to turn off, but that is like flipping the power switch as opposed to selecting shutdown.
Added In: Windows Server 2012, Windows 8
Impact: High Impact When disabled, the host can’t trigger a friendly shutdown inside the virtual machine. All shutdowns will be a hard power-off wich could cause data loss or data corruption.

Hyper-V Time Synchronization Service

Windows Service Name: vmictimesync
Linux Daemon Name: hv_utils
Description: Synchronizes the virtual machine’s system clock with the system clock of the physical computer.
Added In: Windows Server 2012, Windows 8
Impact: High Impact When disabled, the virtual machine’s clock will drift erratically.

Hyper-V Data Exchange Service (KVP)

Windows Service Name: vmickvpexchange
Linux Daemon Name: hv_kvp_daemon
Description: Provides a mechanism to exchange basic metadata between the virtual machine and the host.
Added In: Windows Server 2012, Windows 8
Impact: When disabled, virtual machines running Windows 8 or Windows Server 2012 or earlier will not receive updates to Hyper-V integration services. Disabling data exchange may also impact some kinds of monitoring and host-side diagnostics.+

The data exchange service (sometimes called KVP) shares small amounts of machine information between virtual machine and the Hyper-V host using key-value pairs (KVP) through the Windows registry. The same mechanism can also be used to share customized data between the virtual machine and the host.

Hyper-V Volume Shadow Copy Requestor

Windows Service Name: vmicvss
Linux Daemon Name: hv_vss_daemon
Description: Allows Volume Shadow Copy Service to back up applications and data on the virtual machine.
Added In: Windows Server 2012, Windows 8
Impact: When disabled, the virtual machine can not be backed up while running (using VSS).+

The Volume Shadow Copy Requestor integration service is required for Volume Shadow Copy Service (VSS). The Volume Shadow Copy Service (VSS) captures and copies images for backup on running systems, particularly servers, without unduly degrading the performance and stability of the services they provide. This integration service makes that possible by coordinating the virtual machine’s workloads with the host’s backup process.

Hyper-V Guest Service Interface

Windows Service Name: vmicguestinterface
Linux Daemon Name: hv_fcopy_daemon
Description: Provides an interface for the Hyper-V host to bidirectionally copy files to or from the virtual machine.
Added In: Windows Server 2012 R2, Windows 8.1
Impact: When disabled, the host can not copy files to and from the guest using Copy-VMFile.

Hyper-V PowerShell Direct Service

Windows Service Name: vmicvmsession
Linux Daemon Name: n/a
Description: Provides a mechanism to manage virtual machine with PowerShell via VM session without a virtual network.
Added In: Windows Server TP3, Windows 10
Impact: Disabling this service prevents the host from being able to connect to the virtual machine with PowerShell Direct.

Notes:
The service name was originally was Hyper-V VM Session Service.
PowerShell Direct is under active development and only available on Windows 10/Windows Server Technical Preview 3 or later hosts/guests.

PowerShell Direct allows PowerShell management inside a virtual machine from the Hyper-V host regardless of any network configuration or remote management settings on either the Hyper-V host or the virtual machine. This makes it easier for Hyper-V Administrators to automate and script management and configuration tasks.

Hyper-V, Server 2012 / R2, Server 2016, Virtualization

Advantages of Generation 2 VMs

Generation 2 VMs use synthetic drivers and software-based devices instead, and provide
advantages that include the following:

  • UEFI boot Instead of using the traditional BIOS, Generation 2 VMs support Secure Boot, using the Universal Extensible Firmware Interface (UEFI), which requires a system to boot from digitally signed drivers and enables them to boot from drives larger than 2 TB, with GUID partition tables. UEFI is fully emulated in VMs, regardless of the firmware in the physical host server.
  • SCSI disks Generation 2 VMs omit the IDE disk controller used by Generation 1 VMs to boot the system and use a high-performance virtual SCSI controller for all disks, enabling the VMs to boot from VHDX files, support up to 64 devices per controller, and perform hot disk adds and removes.
  • PXE boot The native virtual network adapter in Generation 2 VMs supports booting from a network server using the Preboot Execution Environment (PXE). Generation 1 VMs require you to use the legacy network adapter to support PXE booting.
  • SCSI boot Generation 2 VMs can boot from a SCSI device, which Generation 1 VMs cannot. Generation 2 VMs have no IDE or floppy controller support, and therefore cannot boot from these devices.
  • Boot volume size Generation 2 VMs can boot from a volume up to 64 TB in size, while Generation 1 boot volumes are limited to 2 TB.
  • VHDX boot volume resizing In a Generation 2 VM, you can expand or reduce a VHDX boot volume while the VM is running.
  • Software-based peripherals The keyboard, mouse, and videos drivers in a Generation 2 VM are software-based, not emulated, so they are less resource-intensive and provide a more secure environment.
  • Hot network adapters In Generation 2 VMs, you can add and remove virtual network adapters while the VM is running.
  • Enhanced Session Mode Generation 2 VMs support Enhanced Session Mode, which provides Hyper-V Manager and VMConnect connections to the VM with additional capabilities, such as audio, clipboard support, printer access, and USB devices.
  • Shielded virtual machines Generation 2 VMs can be shielded, so that the disk and the system state are encrypted and accessible only by authorized administrators.
  • Storage Spaces Direct Generation 2 VMs running Windows Server 2016 Datacenter Edition support Storage Spaces Direct, which can provide a high-performance, faulttolerant storage solution using local drives

 

Hyper-V, Server 2012 / R2, Server 2016, Virtualization

Enabling SR-IOV on VMs

The single root I/O virtualization (SR-IOV) interface is an extension to the PCI Express (PCIe) specification. SR-IOV allows a device, such as a network adapter, to separate access to its resources among various PCIe hardware functions. SR-IOV enables network traffic to bypass the software switch layer of the Hyper-V virtualization stack. Because the VF is assigned to a child partition, the network traffic flows directly between the VF and child partition. As a result, the I/O overhead in the software emulation layer is diminished and achieves network performance that is nearly the same performance as in nonvirtualized environments.

Technically, there are two functions implemented by SR-IOV: physical functions (PFs) and virtual functions (VFs). There are a number of PCI devices available in which the PFs have been implemented, but Microsoft Hyper-V provides SR-IOV support only for networking. In other words, Microsoft Hyper-V provides VFs to allow VMs to communicate to the physical network adapters directly. Since the VMs can communicate directly with the physical network adapters, organizations may benefit from increasing I/O throughput, reducing CPU utilization on Hyper-V hosts for processing network traffic, and reducing network latency by enabling direct communication. Before you can use SR-IOV for a Hyper-V VM, you will need to meet the following prerequisites:

  • The SR-IOV functionality is currently only available to Windows 8 and Windows Server 2012 guests.
  • Hyper-V must be running on a Windows Server 2012 or later operating system.
  • You must have an SR-IOV-capable physical network adapter that implements the PFs and can understand the VFs’ requests coming from the VMs.
  • You must have an external virtual switch that can understand the SR-IOV traffic.
  • The server’s motherboard chipset must also support SR-IOV.

Enabling SR-IOV is a two-step approach. First, you need to create an external switch and enablecSR_IOV or if there is one already created but SR-IOV not enabled, you will need to delete this as this can only be enabled while you are creating the switch. Once the SR-IOV is enabled on the external virtual switch, you can enable SR-IOV on the VMs by checking the “Enable SR-IOV” checkbox found under the “Hardware Acceleration” under Network Adapter settings on the VM’s properties.

4_LI

214

44_LI

 

 

Hyper-V, Server 2016

Which VMs can be shielded?

The shielding process for existing VMs is only available for VMs that meet the following prerequisites:

  • The guest OS is Windows Server 2012, 2012 R2, 2016, or a semi-annual channel release. Existing Linux VMs cannot be converted to shielded VMs.
  • The VM is a generation 2 VM (UEFI firmware)
  • The VM does not use differencing disks for its OS volume.