How To Create A Windows Server Container

How To Create A Windows Server Container

 

In this article, I’ll show you How To Create A Windows Server Container using Windows Containers Server role which Is Installed when Installing Docker for Windows.

Windows Containers Is one of the newest features In Windows Server 2016 It allows us to run a secure Instance of Windows Server which Is complete Isolated and take fewer resources than a Virtual Machine.

For example, Spinning a new VM might take up to 20 minutes without any custom configuration, Spinning a new Container takes 5 seconds.

Based on the Information above you can see the benefit of Containers without getting Into too many technical details about the technology.

The chosen tool by Microsoft to create and manage Containers Is Docker which Is a command line tool that offers a great engine that allows to Run, Delete, Stop etc to our containers.

In the example below, I’ll start a new Windows Server Core 2016 Container with Port 80 and 443 exposed.

docker run -it --name win02 -p 80:80 -p 443:443 microsoft/windowsservercore cmd
How To Create A Windows Server Container
How To Create A Windows Server Container

5 seconds after I Issued the command, I’ll enter the Container cmd tool

It’s Important to note that Containers don’t have a GUI and all management Is done using PowerShell .

How To Create A Windows Server Container
How To Create A Windows Server Container

To exit the container and leave it running I will use the keyboard keys below:

If I press Ctrl + C the containers will stop/

Ctrl p+q

To view running Container I use

docker ps

To view all containers I use

docker ps -a

To stop a Container I use

docker stop e54af59c2895

To delete a container I use

docker rm e54af59c2895

To view all Images I use

docker images

To search for Container Images I use

docker search microsoft

To download use

Docker pull imagename

To run a Nano Server Container Image I use the line blow

docker run -it --name nano01 -p 80:80 -p 443:443 microsoft/nanoserver cmd




Search blogs




Bitnami