Q. What are some key actions to perform when first using Containers on Windows Server 2016?

A. Once you have installed a container host you likely want to actually create a container. By default an install of Containers configures a NAT network which enables containers created to be accessible from the network using the IP address of the container host.

The first step is to download a container OS image. Normally you will want the NanoServer image and the ServerCore image. These can be downloaded as follows:

  1. Open up an elevated command prompt
  2. Run the commands:
    docker images   (currently no images)
    docker pull microsoft/windowsservercore
    docker pull nanoserver/iis
    docker images    (now have images)
  3. You can now create a container instance running Server Core that you can interact with:
    docker run -it microsoft/windowsservercore cmd.exe
    <run commands>
    exit   (when finished)
  4. The container still exists but has existed (since its task, cmd.exe has completed)
    docker ps -a
  5. To delete the container run
    docker rm <ID of the container instance>

For example:

                              
C:\Windows\system32>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
87604fa30100 microsoft/windowsservercore "cmd.exe" 9 seconds ago Exited (0) 2 seconds ago infallible_bartik

C:\Windows\system32>docker rm 87604fa30100
87604fa30100

C:\Windows\system32>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

While you could create a custom image with IIS, for example, you can search the repository for an existing image:

                              
docker search iis
docker pull microsoft/iis

You can now create container instances based on the IIS and customize but that is more advanced. For now you have used a container!