How to Create A Windows Server Container

In this article, I’ll show you how to create a Windows Server Container running on Windows Containers with all the options that are available.

To create a Windows Server Container, I’ll use the Windows Containers technology with the help of the Docker engine management tool.

If you need to setup your Windows Containers Host please visit the following article and our Windows Containers page.

To create a basic Windows Container, I’ll use the docker run command which will create a Windows Nano Server 2016 Container without a specific name. open port or any other customization.

The -it switch will automatically enter you Into the Container terminal

docker run -it microsoft/nanoserver

To create a Windows Container with a custom name and port 80 open I’ll use the following command

docker run -it --name nano1 -p 80:80 microsoft/nanoserver

To create Windows Container that will delete itself on exit I’ll use the –rm

docker run -it --name nano02 --rm microsoft/nanoserver

To create a Windows Container with Hyper-V Isolation I’ll use the command below

docker run -it --isolation=hyperv microsoft/nanoserver cmd

To create a Windows Container and attach it to a storage volume on the Container Host I’ll use the command below

The first two line will create the Data Volume on the host:

docker volume create data01
docker volume ls

Once the volume Is created I’ll create the Windows Container and attach it to the Volume.

docker run --name test01 -it -v c:\programdata\docker\volumes\data01:c:\data01 microsoft/nanoserver cmd


Posted

in

by