Microsoft Hybrid Cloud blogsite about Management

Tag Archives: WindowsContainer

Docker for Windows

An integrated, easy-to-deploy environment for building, assembling, and shipping applications from a Windows PC, Docker for Windows is a native Windows application with a native user interface and auto-update capability, deeply integrated with Windows native virtualization, Hyper-V, networking and file system, making it faster and more reliable than previous ways of getting Docker on a Windows PC

Before you install Docker for Windows 10 make sure you have the right Windows 10 version.
The current version of Docker for Windows runs on 64bit Windows 10 Pro, Enterprise and Education (1511 November update, Build 10586 or later).
And have the Hyper-V feature of Windows 10 installed. Here you can download Docker for Windows 10

Click on Install.

Click Finish and Launch Docker

The Docker VM

Now you can work from Powershell with Docker Containers :

There is also a graphical GUI called Kitematic with the Docker Hub connection for the Container marketplace.

This will download Kitematic.

Extract the zip file and run Kitematic

Kitematic with recommended Docker Containers to download 😉

If you search for Azure you find a lot of Azure related Docker Containers.

It’s so easy to download a container from the Docker Hub and make it running on your Windows 10 Machine, here is an example of an Jenkins Container:

Click Create.

It’s downloading the Docker Container Image.

Jenkins is already running in the Docker Container and is
asking some questions for the setup.

Run the following to create a Nano Server virtual hard drive. The –Containers parameter indicates that the container package will be installed, and the –Compute parameter takes care of the Hyper-V package. Hyper-V is only required if Hyper-V containers will be created.

When completed, create a virtual machine from the NanoContainer.vhdx file. This virtual machine will be running the Nano Server OS, with optional packages.

Configure Nested Virtualization

If the container host itself will be running on a Hyper-V virtual machine, and will also be hosting Hyper-V Containers, nested virtualization needs to be enabled. This can be completed with the following PowerShell command.

Configure Virtual Processors

If the container host itself will be running on a Hyper-V virtual machine, and will also be hosting Hyper-V Containers, the virtual machine will require at least two processors. This can be configured through the settings of the virtual machine, or with the following PowerShell script.

PS C:\> Set-VMProcessor –VMName <VM Name> -Count 2

Enable Hyper-V Role

If Hyper-V Containers will be deployed, the Hyper-V role needs to be enabled on the container host. If the container host is a virtual machine, ensure that nested virtualization has been enabled. The Hyper-V role can be installed on Windows Server 2016 or Windows Server 2016 Core using the following PowerShell command.

PS C:\> Install-WindowsFeature hyper-v

Create Virtual Switch

Each container needs to be attached to a virtual switch in order to communicate over a network. A virtual switch is created with the New-VMSwitch command. Containers support a virtual switch with type External or NAT.

This example creates a virtual switch with the name “Virtual Switch”, a type of NAT, and Nat Subnet of 172.16.0.0/12.

Configure NAT

In addition to creating a virtual switch, if the switch type is NAT, a NAT object needs to be created. This is completed using the New-NetNat command. This example creates a NAT object, with the name ContainerNat, and an address prefix that matches the NAT subnet assigned to the container switch.

Finally, if the container host is running inside of a Hyper-V virtual machine, MAC spoofing must be enable. This allows each container to receive an IP Address. To enable MAC address spoofing, run the following command on the Hyper-V host. The VMName property will be the name of the container host.

Install OS Images

An OS image is used as the base to any Windows Server or Hyper-V container. The image is used to deploy a container, which can then be modified, and captured into a new container image. OS images have been created with both Windows Server Core and Nano Server as the underlying operating system.

Container OS images can be found and installed using the ContainerProvider PowerShell module. Before using this module, it needs to be installed. The following commands can be used to install the module.

Issue: Save-ContainerImage and Install-ContainerImage cmdlets fail to work with a WindowsServerCore container image, from a remote PowerShell session.Workaround: Logon to the machine using Remote Desktop and use Save-ContainerImage cmdlet directly.