- Open a PowerShell window with administrative rights.
- Type docker info at the PowerShell prompt. You should only have one container at this time.
- Next we need see what images are in our repository. To do this, type docker images in the PowerShell window. This will show you your Docker images (see Figure 12.10).
FIGURE 12.10 Docker images
4. We need the Image ID from the Nano Server or Server Core that we downloaded in Exercise 12.2. The Image ID for my Nano Server is d9bccb9d4cac. We will use this ID to turn the image into a container. Type the following at a PowerShell prompt (your Image ID will be different) and press Enter (see Figure 12.11):
docker run d9bccb9d4cac
FIGURE 12.11 Docker run command
5. Type docker info at the PowerShell prompt. You should now have two containers instead of just one (see Figure 12.12).
EXERCISE 12.3
6. Close PowerShell.
Tagging an Image
You can change the tags associated with the images. Many administrators use tag names as version names so that they can keep track of the various images on their machine.
Having tags that you create allows you to easily access the images later by their tag names. To tag an image, you use the -t parameter. So to tag an image as WillPanekImage, you’d use the following:
docker build – t WillPanekImage
Uninstall an Operating System Image
One of the maintenance issues that many IT administrators must deal with is hard drive space. As you are downloading and using images, there may be a time when you need to remove images from your server that are no longer being used.
If you continue to download and use multiple images files, make sure that every once in a while you look at all of your images and delete any that are no longer valid or no longer in use.
Exercise 12.4 will show you how to remove an image file from your host system. To complete this exercise, make sure that you have completed the earlier exercises in this chapter.
EXERCISE 12.4
Uninstalling an Image
- Open a PowerShell window with administrative rights.
- Type docker images and get the ID number of the Nano Server image.
- Type docker rm d9bccb9d4cac (replace d9bccb9d4cac with your ID number).
- Type docker images. The image is now gone.
- Close PowerShell.