Infrastructure at your Service

One of the new feature which will come with Windows Server 2016 is the Containers. Microsoft made available its fourth technical preview of his Windows Server 2016 platform  some days ago. This new Technical Preview brings with it and for the first time Hyper-V Containers as the Technical Preview three came with the first release of Windows Server Containers.
I will discuss about the difference of those two types of Container later in this blog.
But first let’s have a brief introduction to Container.

Principle

What is a Container?

It is a new virtualization technology, an Operating System virtualization. It makes believe to an application that it is running in a dedicated environment with its own libraries, all the features of the host Operating System even if it is not the case.  It is an isolated, independent and portable operating environment.
This container will be easily moved from a machine to another one, from a cloud to another cloud or from a test server to a pre-production server…
It is a really development and test oriented feature.

Container history

Containers have been originally created to facilitate international shipping all over the world as they have a standardized size to be able to go over all boats, trains, trucks… This standardization brings a better industrialization and therefore lower transport costs.
Containers in IT have been used the same approach to virtualize some processes and since more than one decade some products exist as following:
Parallels Virtuozzo (2001)
Solaris Containers (2005)
Linux LXC (2008)
Docker (2013)

Docker uses a lot of  known tools but make it use simpler: best packaging and new functionalities which make the use of it more efficient and simpler.
Docker virtualizes the FileSystem, the NameSpaces, the CGroups ( limitation and prioritization of resources CPU, RAM, Network…)… all the different component of the Operating System. The container uses the host OS, thus it will not be possible to instantiate a Linux container in a Windows running a Docker Engine and vice versa.

Virtual Machines versus Containers

Virtual machines run on the top of a physical machine which includes an hypervisor and a host Operating System. In their turn, virtual machines run with an Operating System, binaries and a set of libraries. Applications installed on it may consume all these resources if requested.

Container_1

Unlike traditional virtual machines, containers run on the top of a physical machine that includes a host Operating System, either a Docker Engine or a Container Engine and a set of libraries and Binaries usable by applications.
You can run more Containers than Virtual Machines on the same host server as Container are more lightweight.
Containers don’t need their own CPU, RAM, set of binaries and libraries, disks space… There is a big difference compared to Virtual Machines which share host resources and need their own Os, disks, libraries, …

Container_2

Docker

Docker is an Open-source solution to manipulate LXC Container. It is a Client Server oriented model: with a Docker  client and Docker Engine. Docker has more or less forty command used via command line to list all images, start a container, publish an image in a repository (private or public)…

Docker Client and Engine

The Docker Client (command line) is available for Mac, Linux and Windows.
Some commands are:
docker run: to instantiate a new container
docker pull: to retrieve an image
docker build: to build a new image

The Docker Engine (Docker host) is only available for Linux distribution (Ubuntu, RedHat…). But this Linux machine can be a virtual machine on Azure, Hyper-V, VMware…

Image Docker & Dockerfile

A Docker image represents more or less the filesystem of the Operating System, but is in an inert state. Each image is constituted of a certain number of layers.
Images are created from a configuration file named Dockerfile which describes exactly what need to be installed on the system.

Docker Hub

Docker hub is a public repository of container images.
It offers:

  • a Registry: Storage system for container images
  • a public index: list of public images with evaluation system and sorting feature
  • automated builds: to link a code repository GitHub or Bitbucket and automatically create Docker images after each commit of the source code

Docker & Microsoft

Partnership

More or less one year and a half ago, Microsoft announced his partnership with Docker. Now, Docker is in the Azure MarketPlace:

Container_3

and application in Container also:

Container_4

The partnership has brought:

  • Extension of the Docker API and Docker tools to be able to support Windows Containers
  • Docker Client CLI (Command Line) on Windows
  • Docker extension for Linux VM on Azure
  • Docker Compose and Docker Swarm supported on Azure
  • Visual Studio tools for Docker
  • Docker Container in the Azure MarketPlace

 Container on Windows Server 2016

As Container is a new feature of Windows Server 2016, you will have to install it as a normal feature.
For that go to Server Manager, Manage and click on “Add Roles and Features”. In the wizard, in the Feature screen just select the Container feature:

Container_8

Once it is intalled, you can open a Powershell windows and have a look at the possible PowerShell Cmdlets for Containers:

Container_10

I will play with those new Cmdlets in a future blog, but here let’s continue to explain how Microsoft has integrated those containers in Windows Server 2016.

The Docker Client, docker.exe, is shown as a command line, the goal is to have a unique client which is able to manage Linux and Windows Container.
The command line docker.exe will be able to instantiate images of Linux or Windows Container. But a container can only run on a host machine which executes the Docker Engine that runs on the same OS.
A Linux container will use the Kernel of the host machine which executes the Docker Host on Linux.
We did OS virtualization and not machine virtualization.

Container_5

Type of Container

Windows Server Container

  • runs on Windows Server 2016
  • uses libraries and functionalities of the Windows kernel
  • container is managed via a Container Management Stack interfaced with
    • Docker
    • PowerShell & WMI objects

Container_6

Hyper-V Container

  • adds an isolation level between each Container and the Management Stack based on Hyper-V partitions
  • uses libraries and functionalities of the Windows kernel
  • container is managed via a Container Management Stack interfaced with
    • Docker
    • PowerShell & WMI objects

Container_7

 Container environment

Container Run-Time

  • Windows Server 2016 if you want to run Windows Container
  • Linux if you need to run Linux container

Image Repository

  • Docker Hub: Registry public
  • DTR: Docker Trusted Registry for enterprises which want their own Private Image Repository

Container images

  • Container instantiated and based on a stacking of images

Managing Container

To be able to manage Containers, PowerShell script is used. Here some PowerShell commands:

  • Get-Containerimage: to search all container images in a Repository
  • New-Container -Name ‘Test’ -ContainerImageName ‘Windows’: create a new container image in the Repository named ‘Test’ and based on image ‘Windows’
  • Start-Container ‘Test’: to start the container created previously
  • cmd /c node.msi: on a container to install for example a msi package, our container is running and is open for writing
  • Stop-Container ‘Test’: to stop the container named ‘Test’
  • New-ContainerImage -ContainerName ‘Test’ -Name ‘NewVersionTest’: create a new container image in my Repository based on the image I just modified and now stopped

Development Process

The development process for a Container is as follow:

  • Each developer has his own local repository
  • Import container from the Central Repository of the enterprise. All dependent containers are also imported with the selected one
  • the developer will develop his application, compile it … and will build a new container image
  • the developer push this new image in the Central Repository
  • this new image is now available for everybody

 

Containers will help developers to build and easily deploy much faster high quality applications. Containers will also help administrators to create quickly and easily new architecture for test, development  or production environment and will simplify the maintenance and update.
Let’s see how Container will modified this ecosystem.

Leave a Reply

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

Stéphane Savorgnano
Stéphane Savorgnano

Consultant