Setup Windows Server 2016 As A Container Host

In this article I’ll show you how I setup A Windows Server 2016 as a Container Host with Docker and Hyper-V.

Before you start please visit the Windows Server 2016,Windows Containers and Docker pages.

You might be Interested In:

Setup Windows Server Core 2016 As A Container Host

Setup Nano Server 2016 As A Container Host

Setup Windows Container Host On Microsoft Azure

Because I’m using a Hyper-V Virtual Machine to run my Container Host I have configured my VM with nested Virtualisation using the article I had published Enable Nested Virtualization In Windows 10 Build 1511 before the release of build 1551.

To get started, first Install Hyper-V on the Container Host.

Get-windowsfeature hype* | install-windossfeature

Next I’ll Install Windows Containers Server role:

Install-windowsfeature containers

Next I’ll Install the Container Image package provider In order to be able to download Containers Images:

Install-packegeprovider containerimage -force
Find-containerimage

Next I’ll Install the Windows Server 2016 Core Image that will allow me to run Windows Server Core Containers.

Note: You can’t run Nano Server Container on a Windows Server 2016 Container Host.

To run Nano Server as Container you will need to run Nano Server as the container host.

Install-containerimage -name WindowsServerCore

To confirm that the Installation Is successful run:

Get-containerimage

To Install Docker run:

Invoke-WebRequest https://aka.ms/tp5/Update-Container-Host -OutFile update-containerhost.ps1
.\update-containerhost.ps1

Next we need to Tag out Docker Image to be the latest using the line below (make sure you change the Image ID)

Docker images
Docker tag 7e15f95e69f7 windowsservercore:latest

Run Windows Container

Docker run -it windossservercore cmd

Done, don’t forget to visit the Docker page I have created.


Posted

in

by