- Restrict installation of (USB) devices using Group Policy - Mon, Sep 13 2021
- Windows Server 2022: Comparison of editions and features - Tue, Sep 7 2021
- Microsoft will not release a free Hyper-V Server 2022 - Mon, Sep 6 2021
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.
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 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.
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.
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.
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.
To get into the container using PowerShell, enter the following command on the console of the container host:
Subscribe to 4sysops newsletter!
docker exec -ti <Container-Name> powershell