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

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/

Author: Robert Smit [MVP]

Robert Smit is Senior Technical Evangelist and is a current Microsoft MVP in Clustering as of 2009. Robert has over 20 years experience in IT with experience in the educational, health-care and finance industries. Robert’s past IT experience in the trenches of IT gives him the knowledge and insight that allows him to communicate effectively with IT professionals who are trying to address real concerns around business continuity, disaster recovery and regulatory compliance issues. Robert holds the following certifications: MCT - Microsoft Certified Trainer, MCTS - Windows Server Virtualization, MCSE, MCSA and MCPS. He is an active participant in the Microsoft newsgroup community and is currently focused on Hyper-V, Failover Clustering, SQL Server, Azure and all things related to Cloud Computing and Infrastructure Optimalization. Follow Robert on Twitter @ClusterMVP Or follow his blog https://robertsmit.wordpress.com Linkedin Profile Http://nl.linkedin.com/in/robertsmit Robert is also capable of transferring his knowledge to others which is a rare feature in the field of IT. He makes a point of not only solving issues but also of giving on the job training of his colleagues. A customer says " Robert has been a big influence on our technical staff and I have to come to know him as a brilliant specialist concerning Microsoft Products. He was Capable with his in-depth knowledge of Microsoft products to troubleshoot problems and develop our infrastructure to a higher level. I would certainly hire him again in the future. " Details of the Recommendation: "I have been coordinating with Robert implementing a very complex system. Although he was primarily a Microsoft infrastructure specialist; he was able to understand and debug .Net based complext Windows applications and websites. His input to improve performance of applications proved very helpful for the success of our project

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: