Get started Bring yourself up to speed with our introductory content.

Learn how to start using Docker on Windows Server 2019

Getting started with Windows containers requires an understanding of basic concepts and how to work with Docker Engine. Orin Thomas' book covers the topics admins need to know.

As many Windows administrators migrate both their workloads and their skills to the cloud, there's a good chance using Docker on Windows Server 2019 will be part of that journey.

While traditional virtualization using the VMware and Hyper-V platforms still has its place, the benefits of containerized applications are difficult to ignore and might make inroads with many enterprises over the next several years. As the name implies, containers hold both the application and its dependencies. This application bundling makes containers highly portable, allowing them to run on just about every OS, as well as different cloud providers, without modification.

But this level of efficiency requires a certain level of technical proficiency. Administrators will need to learn how to use the Docker engine -- the underlying container technology used in Windows Server 2019. While some container management can be done in the Windows Admin Center, Docker on Windows Server 2019 is largely driven by the command line.

Windows Server 2019 Inside Out by Orin Thomas gives an in-depth look at using the newest features and enhancements in Microsoft's latest server OS, including core technologies such as Active Directory and the latest innovations with containers. This book contains everything needed to get started on the next stage of professional development, from basic container terminology to installing Docker on Windows Server 2019.

Once you get the container fundamentals down, Thomas covers more advanced areas, such as Kubernetes and Docker Swarm -- the two types of container orchestration supported on Docker on Windows Server 2019. Orchestration handles many core management tasks, including health monitoring, failover of container hosts and application upgrades.

The following excerpt comes from Chapter 10, entitled "Containers," from Windows Server 2019 Inside Out and explains how to perform container management using Docker on Windows Server 2019.

Managing containers

You use Docker to perform all container management tasks on computers running Windows Server. At present, the container management functionality available in Windows Admin Center is limited, but it's likely that over time, most tasks that you can perform from the Docker prompt will be available in WAC.

Starting a container

You create a new container by specifying the container image from which you wish to create the container. You can start a container and run an interactive session either by specifying cmd.exe or PowerShell.exe by using the -it option with docker run. Interactive sessions allow you to directly interact with the container through the command line from the moment the container starts. Detached mode starts a container, but it doesn't start an interactive session with that container.

For example, to start a container from the Microsoft/windowsservercore image and to enter an interactive PowerShell session within that container once it is started, use this command:

Docker run -it mcr.microsoft.com/windows/servercore:ltsc2019 powershell.exe

Also important is that, by default, containers use network address translation. This means that if you are running an application or service on the container that you want to expose to the network, you'll need to configure port mapping between the container host's network interface and the container. For example, you would run the following command if you had downloaded the Microsoft/iis container image and you wanted to start a container in Detached mode and map port 8080 on the container host to port 80 on the container.

Docker run -d -p 8080:80 mcr.microsoft.com/windows/servercore/iis:windowsservercore -ltsc2019

This is only the very basic sort of information you'd need to get started with a container, and you will learn more about container networking later in this chapter.

You can verify which containers are running by using the docker ps command … or by using the Windows Admin Center. The problem with the simple docker ps command option is that this will only show you the running containers and won't show you any that are in a stopped state. You can see which containers are on a container host, including containers that aren't currently running, by using the docker ps -a command.

You can also view the containers that are on a Windows Server container host using Windows Admin Center, if you have loaded the Containers extension.

One thing that you'll notice about containers is that they appear to be assigned random names, such as sarcastic_hedgehog, dyspeptic_hamster and sententious_muppet. Docker assigns random names, rather than asking you for one, because containers are a more ephemeral type of application host than a VM; because they are likely to only have a short lifespan, it isn't worth assigning any name that you'd need to remember. The reason for the structure of the random names is that they are easy to remember in the short term, which makes containers that you must interact with on a short-term basis easier to address than when using hexadecimal container IDs.

Editor's note: This chapter excerpt comes courtesy of the publisher, Pearson. Windows Server 2019 Inside Out by Orin Thomas is available from the Pearson site. The publisher also offers a discount to SearchWindowsServer readers. Enter the code WINTECH at checkout to receive a 40% discount. Offer expires Dec. 31, 2021.

Dig Deeper on Windows containers and OS level virtualization

SearchServerVirtualization
SearchCloudComputing
SearchSQLServer
SearchEnterpriseDesktop
SearchVirtualDesktop
Close