Windows Containers on Windows Server (Docker)

What is Container ?

Containers are isolated,resource controlled, and portable operating environment. By using the containers we can run the applications without affecting to rest of the system application.Its looks same as the fresh installation of a server.

Windows Container Types

Windows Server Containers

This provides application isolation through process and namespace isolation. In this method container shares the kernel with container host.

Hyper-V Containers

In this method isolation is provided by running each container in highly optimize virtual machine. In this method containers won’t share the kernel with the container host.

Lets look how  we configure Windows containers in Server 2016.

Before install docker we need to install the container feature in Windows Server 2016.

Install Docker on Windows Server 2016

First install the OneGet PowerShell module

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

Install the latest version of Docker.

Install-Package -Name docker -ProviderName DockerMsftProvider

After installation restart the computer and lets verify the docker service up and running

Lets verify the docker client and server architecture and you will notice its Windows. If you played containers in Linux world the server client architecture will be Linux.

docker version

You can enter following command to get full info about docker container environment.

docker info

Next pull an IIS image from docker repository. we can use following command to find image or repository.

docker search iis


Pull the image from repository

docker pull microsoft/iis


Lets verify image is available in container host

docker images

Now I’ll run the container using IIS image. In this demo I’ll map container port 80 to the host port 80 to access the IIS web server from outside of the container

docker run -p 80:80 microsoft/iis

In following screenshot you will see the port 80 is accessible from the internet.

To verify IIS working I hit the container host IP to the web browser because of port mapping to the container I can see the default web page of the IIS server