Build your Windows Server Container and create Windows Server Containers and Windows Server Container Images #ws2016 #winserv   Leave a comment

What are containers?

They are an isolated, resource controlled, and portable operating environment.

Basically, 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.

If you were inside a container, it would look very much like you were inside a freshly installed physical computer or a virtual machine. And, to Docker, a Windows Server Container can be managed in the same way as any other container.

The windows Server Container can be used to package a Windows Server application, and Microsoft’s .Net framework application and can be easily moved across different servers or from your test cloud to the production cloud.

image

Install-WindowsFeature –name Containers

By default you will not see any change only a few PowerShell commands.

Get-Command -Module containers

image

But I this scenario I have a Windows server 2016 and I will build a container in a VM

image 

Important links :

Get your Container VM this image is about 6Gb and a slow download http://aka.ms/containerhostvhd 

It all starts here samples of containers ready for testing https://github.com/Microsoft/Virtualization-Documentation

https://raw.githubusercontent.com/Microsoft/Virtualization-Documentation/master/windows-server-container-tools/New-ContainerHost/New-ContainerHost.ps1

On my Hyper-v Server 2016 I opened Powershell

#gGet script download New-ContainerHost-Source.ps1
wget -uri http://aka.ms/newcontainerhost -OutFile c:\New-ContainerHost.ps1

#Run script to create a new container
.\New-ContainerHost.ps1 –VmName MVPContainer01 -Password Password01

image

You will need to accept the Eula

the script will download the VM and configure it in the Hyper-v server.

Using VHD path C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
Copying VHD archive (6 GB) from http://aka.ms/containerhostvhd to C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\WindowsServer_en-us_TP3_Container_VHD.zip (this may take a few minutes)…

The Download is not fast at all so this will take some time So I have plenty of time to make some screenshots

image

and yes I used a clear password

image

 

Docker is already installed.
NSSM is already installed
Creating Docker program data…
Configuring NSSM for Docker service…
Waiting for Docker daemon…
Successfully connected to Docker Daemon.
Tagging new base image…
Script complete!
VM MVPContainer01 is ready for use as a container host.
See http://msdn.microsoft.com/virtualization/windowscontainers for more information about using Containers.
The source code for these installation scripts is available here: https://github.com/Microsoft/Virtualization -Documentation/tree/master/windows-server-container-tools

 

image

By default the VM is not connected to a Switch and be aware of the disk placement, Containers are based on Differencing disk

#This VM is not connected to the network. 
Get-VM mvp* | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -Switchname vSwitch

and in case you wonder why did I need this password. ? take a look in the unattended XML ( unless you do a lock )

Autologon count = 999 so in the first reboot you won’t need a password.

Ok but now what I have a VM running and this VM is running Core

Let us check things run

#get the Image name

Get-ContainerImage 

#get the Virtual Switch name this is not the Hyper-v switch!

Get-VMSwitch

 

image

with the Get-Container you can see the Created Containers

All containers are Stopped and we need them to start

Start-Container my*  to start all containers

image   image

Remote management without the container ID is not posible

get-container |ft containername,ContainerId

Below is a little snapshot of the Container. the Master disk WindowsServer_en-us_TP3_Container_VHD.vhd and the Differencing disks that are running as Container VM

image

ContainerVHDVersion.10514.2.txt  means This file indicates the web version of the base VHD

To manage a Container session

Enter-PSSession -containerId b6e784a6-632d-4efb-8e48-89496ee2abfa –RunAsAdministrator

Be aware you will need the ContainerId to enter this session

image

Checking the IP as well the Container IP Remember the Firewall is on and really you need to powershell a lot the get things done and far from easy. And if you build this in a LAB of Home server and SSD is a must.

In the next Post I’ll show you how to run stuff in the Container and set thing up.

SQL is a great option to run this in a Container. I started over several times and still I miss some great tools to easy manage this.

image

I hope there Will be a VMM or Hyper-v plugin to manage this all else it would be hard to manage all this.

Happy Clustering

Robert Smit

https://robertsmit.wordpress.com/

Posted August 25, 2015 by Robert Smit [MVP] in Windows Server 2016

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • Twitter

  • %d bloggers like this: