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

<br />
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force<br />

Install the latest version of Docker.

<br />
Install-Package -Name docker -ProviderName DockerMsftProvider<br />

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.

<br />
docker version<br />

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

<br />
docker info<br />

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

<br />
docker search iis<br />

Pull the image from repository

<br />
docker pull microsoft/iis<br />

Lets verify image is available in container host

<br />
docker images<br />

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

<br />
docker run -p 80:80 microsoft/iis<br />

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

, , , , ,

Post navigation