Create and run Docker containers with Windows Admin Center

Version 2009 of Windows Admin Center (WAC) includes an update to the Container extension, which allows the container feature to be installed on a host. You can also use it to create images and run containers based on them. In addition, there is a simple monitoring function.

When Microsoft introduced support for Docker containers in Windows 10 1607 and Server 2016, there were no (graphical) management tools available to manage the feature from start to finish. It required a number of manual steps (mostly on the command line) to get a container up and running.

The container extension (version 1.121.0) included in WAC 2009 makes it much easier to use containers under Windows. It covers the whole range of tasks, from installing the feature to creating images and running containers.

Adding container support to the host ^

If you connect in WAC to a computer that has not yet installed container support and switch to the menu item Containers, the tool offers the option of adding it. This works for both Windows Server and Windows 10.

If the container feature is missing on a host the WAC extension offers to install it

If the container feature is missing on a host the WAC extension offers to install it

While a bare metal installation or a virtual machine is sufficient for Windows Server, the client OS must also be able to run Hyper-V. The reason is that all available container images are based on Windows Server and therefore cannot be executed directly on Windows 10.

Creating a container image ^

After you add the container feature and restart (required), the WAC extension shows its functions. In addition to the Summary menu item, where you can get some statistics, the Images and Container tabs are of particular importance.

Each container is based on an image, so in the first step you either create one yourself or download an existing one from a repository. If you choose Create New, you will get a dialog box that makes it a bit easier to create a Dockerfile for a container-based web server by using a form.

The form simplifies the creation of the Dockerfile to which you can then add your own entries

The form simplifies the creation of the Dockerfile to which you can then add your own entries

The first two drop-down menus determine the image to be downloaded from the Docker Hub, at least if you opt to use a static website. For your own web projects, the tool will select the matching image after choosing a specific version of the .NET framework.

The last two input fields are used for adding the name of the image and an image tag. The latter usually holds a version number.

As you can see, the form generates only a rudimentary Dockerfile based on the six input fields. However, further customizations can be made in the preview shown in the lower frame. The Docker reference site provides information about the entries allowed there and their syntax.

If you create an image for a web server container, it is a common practice to manage it remotely via the IIS Manager. This requires, among other things, the installation of the management service on the host. This can be automated via the Dockerfile. Microsoft's developer blog shows you how it works.

Downloading images ^

If you want to start with one of the standard images for Windows, you can download it with the Pull command. This opens a form where you can enter the repository and the image tag.

But you will most likely use the easier method for generic images, and select the one you want under the Common Windows Images section.

The WAC extension also provides a graphical interface for Docker pull the default images are predefined

The WAC extension also provides a graphical interface for Docker pull the default images are predefined

If you open the entries under the individual categories, you can choose between the different versions of Windows. Which one you choose is not left to your personal preference. Rather, you have to take an image that matches the version of the container host.

Creating a container ^

For this purpose, mark the image based on which you want to create the container and click Run. This opens another form, with which you can customize the container and its runtime environment.

As with creating a new image, the form here also shields the user from the Docker commands. While the first case is about simplifying the creation of a Dockerfile, here WAC helps to select the parameters for docker run.

WAC helps to put together the Docker run command

WAC helps to put together the Docker run command

Use the input fields to specify the name of the container, the available memory, and the number of CPUs to be allocated to it. It is important to define port mapping under Publish port(s). The first part, before the colon, determines the port on the host over which the port of the container should be accessible.

The default value 8000:80 means that port 80 of the container should be accessible via port 8000 of the host. If a Web server is running in the container, then in this example it would be accessible at an address like http://ContainerHost.contoso.com:8000.

With mapping 8000:80, the start page of the IIS in the container is accessible via port 8000 of the host

With mapping 8000:80, the start page of the IIS in the container is accessible via port 8000 of the host

Parameters that are not covered by the form can be entered by opening the corresponding input field under Add. The command reference for Docker run can be found in the Docker documentation.

Managing containers ^

Once you have started a container, it will appear in the Container tab among all the others that are currently running. If you select one of them, the detailed view opens in the lower part of the window.

Here, WAC will show CPU and RAM usage in real time. Also interesting are the possibilities of retrieving events from the logfile and viewing details about the container.

Usually you want to be able to connect to containers and manage them via a command line. The Console tab in the lower part of the window should serve this purpose. However, it only establishes a PowerShell session to the host.

A PowerShell session in the container is obtained via the docker exec

A PowerShell session in the container is obtained via the docker exec

To get into the container using PowerShell, enter the following command on the console of the container host:

2+
avataravatar

Poll: Does your organization plan to introduce Artifical Intelligence?

Read 4sysops without ads and for free by becoming a member!

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account