This content is part of the Essential Guide: The beginner's guide to Hyper-V
Manage Learn to apply best practices and optimize your operations.

Manage Windows containers and Hyper-V containers with these tools

You can use a number of tools for Windows and Hyper-V container management, including Docker and PowerShell, depending on your experience and skill set.

If you have hundreds of containers deployed in your environment, managing each container without a centralized...

tool can be painful. Luckily, you can use native tools, such as Docker CLI and Windows PowerShell, or a third-party GUI tool to manage Windows and Hyper-V containers.

The initial development of any technology doesn't often include many management options. The developer typically provides only the necessary tools -- via a command line -- to manage every aspect of the technology and then provides APIs for vendors to design additional management platforms. When it comes to managing Windows or Hyper-V containers, you can use the Docker command-line interface, PowerShell, RunHCS, and similar command line and GUI tools.

Use Docker CLI to manage Windows containers

Docker CLI is the default tool to manage containers and is most appealing to admins who already use Linux Docker command-line tools. Docker CLI has the capability to manage all Windows container tasks, from creating a container to killing it. Below are some commands using Docker CLI.

Use the following command to start a container with a Nano Server image:

Docker run –it /Microsoft/nanoserver

Use the command below to list Docker processes:

Docker ps –a

Take advantage of container PowerShell commands

If you're a seasoned Windows admin, you might want to use something you're already familiar with, such as Windows PowerShell. Fortunately, Microsoft provides similar PowerShell commands to manage containers that are much easier to use than Docker CLI. PowerShell removes the added complexity found in Docker. For example, Docker CLI requires the command syntax to be in lowercase letters.

If you've worked with PowerShell for some time, you'll find it easy to code a container script and have it run when and as needed. As you can see in the PowerShell command below, you aren't required to ensure that the command syntax is in lowercase:

New-Container –Name TestContainaer –ContainerImageName WindowsServerCore –SwitchName "V1"

Use Docker CLI with PowerShell commands

One of the biggest advantages of using Windows PowerShell to manage containers is that you can use Docker CLI in conjunction with PowerShell. For example, if you want to list container processes with Process ID, executing the command below will give you the desired results:

docker exec -it --privileged admin1 powershell -Command Get-CimInstance Win32_Process | Select-Object ProcessId, CommandLine

Manage containers using RunC or RunHCS

RunHCS is a CLI implementation of the Open Container Initiative specification. RunHCS runs on Windows machines and communicates with Host Compute Service to create and manage containers. For example, to start a container using RunHCS, use the command below:

RunHCS run <–container ID>

Consider third-party container GUI tools

This is where Microsoft still needs to do further development. Unfortunately, Microsoft hasn't provided a GUI tool for admins to manage Windows or Hyper-V containers. However, there are many third-party tools available you can use. For example, there's a tool called Windows Server Container Manager that you can download from Microsoft TechNet and test drive on Windows Server 2016 containers.

If you want to use an enterprise-level GUI, Kubernetes is the standard for container management and orchestration. If you have a large number of containers deployed in your environment, Kubernetes provides all necessary functions. On March 25, 2019, Craig Peters, principal program manager of Azure Container Compute, announced that the release of Kubernetes version 1.14 includes support for Windows Server containers.

Dig Deeper on Application virtualization