First actions to get going with Containers and Docker

Get going with first actions with containers on Windows Server

John Savill

December 8, 2016

1 Min Read
First actions to get going with Containers and Docker

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

    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

For example:

C:Windowssystem32>docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES87604fa30100 microsoft/windowsservercore "cmd.exe" 9 seconds ago Exited (0) 2 seconds ago infallible_bartikC:Windowssystem32>docker rm 87604fa3010087604fa30100C:Windowssystem32>docker ps -aCONTAINER 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 iisdocker 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!

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like