INF215x Virtualization Practical Exercises OverviewMicrosoft+INF215x+2T...store the virtual machines...

22
INF215x Virtualization – Practical Exercises Overview This course comes with a virtual lab environment where you can practice what you learn. Launch the lab environment from the Welcome > Getting Started > Practice Lab Environment page. You will only have four hours in the practical environment. The time is cumulative, so you can work a little bit at a time until it adds up the total time allowed. You may not have enough time to complete all the practical exercises. So, choose wisely. You may want to consider all the hand-on exercises and decide which ones you want to make sure you work on first. In most cases, the userid is Adatum\Administrator and the password is Pa55w.rd, but read the instructions carefully. If you are having difficulties with the lab environment check out the Student Lab Guide. This document is available from the Course Handouts page and includes basic troubleshooting and the support desk link. Recommendation: Bookmark the edX Practice Lab Environment page as you will return to it frequently to perform your hands-on labs!

Transcript of INF215x Virtualization Practical Exercises OverviewMicrosoft+INF215x+2T...store the virtual machines...

  • INF215x Virtualization – Practical Exercises

    Overview

    This course comes with a virtual lab environment where you can practice what you

    learn. Launch the lab environment from the Welcome > Getting Started > Practice

    Lab Environment page.

    • You will only have four hours in the practical environment.

    • The time is cumulative, so you can work a little bit at a time until it adds

    up the total time allowed.

    • You may not have enough time to complete all the practical exercises.

    So, choose wisely. You may want to consider all the hand-on exercises

    and decide which ones you want to make sure you work on first.

    In most cases, the userid is Adatum\Administrator and the password is Pa55w.rd,

    but read the instructions carefully.

    If you are having difficulties with the lab environment check out the Student Lab

    Guide. This document is available from the Course Handouts page and includes

    basic troubleshooting and the support desk link.

    Recommendation: Bookmark the edX Practice Lab Environment page

    as you will return to it frequently to perform your hands-on labs!

  • Notice in the lab environment you can copy information to the virtual machines by

    using the Actions > Paste Content window. Before you paste the content, be sure

    your cursor is where you want the copied data.

    1 | Virtualization Concepts

    Confirm the Hyper-V Role Installation

    In this exercise, you will confirm the installation and settings of the Hyper-V role

    using the Hyper-V Manager, various tools and Windows PowerShell.

    Note: The Hyper-V role has been pre-staged on LON-HOST1 because of nested

    virtualization limitations within the lab environment. You will begin your lab with

    the Hyper-V role already installed.

    Verify the Hyper-V Role installation and examine settings

    1. Sign in to LON-HOST1 by using the account Adatum\Administrator with the

    password Pa55w.rd.

    2. In Server Manager, click Tools and then click Hyper-V Manager.

  • 3. In Hyper-V Manager, click LON-HOST1, and in the Actions pane, click Hyper-V

    Settings.

    4. In the Hyper-V settings of LON-HOST1, verify the following settings:

    • Keyboard: Use on the virtual machine

    • Virtual Hard Disks: C:\Users\Public\Documents\Hyper-V\Virtual Hard

    Disks

    5. Examine other Hyper-V settings for LON-HOST1 in the user interface. You will

    configure other settings in subsequent exercises.

    Other ways to verify Hyper-V Role installation and functionality

    1. You’ve already seen that the Hyper-V role is listed as an installed role on the

    Dashboard in Server Manager.

    2. In Windows PowerShell, use the Get-WindowsFeature cmdlet to confirm that

    both the Hyper-V role and the subfeature to Remote Server Administration

    Tools, Hyper-V Management Tools are installed.

    3. In Windows PowerShell, use the Get-Command –Module Hyper-V cmdlet to

    confirm that the Hyper-V module has been installed. The output returns

    many cmdlets, confirming that the Hyper-V module is installed and available.

    4. In Windows PowerShell, use the bcdedit.exe command to verify that

    hypervisor is configured to start automatically. In the output, in the Windows

    Boot Loader section, verify there is a hypervisorlaunchtype Auto line.

    5. Confirm that the Hyper-V Manager program is installed. Hint! Search from

    the Start screen.

    6. In Event Viewer, confirm there is Hyper-V information.

    7. In Performance Monitor, confirm that multiple counters that start with the

    word Hyper-V are available. (In the Add Counters dialog box, ensure that

    is selected.)

    8. In the Windows Firewall with Advanced Security snap-in, confirm that

    multiple inbound Windows Firewall rules that start with the word Hyper-V

    display.

    9. In Control Panel, search for services, and click View local services. In the

    Services window, verify that multiple services that start with the word Hyper-

  • V display, including a service named Hyper-V Virtual Machine Management,

    which has a status of Running.

    10. In Windows PowerShell, use the Get-VMHost | Format-List command to view

    the Hyper-V Server settings.

    2 | Hyper-V Components

    Configure Hyper-V Settings

    In this exercise, you will create a network share for storing virtual machines and

    then configure a virtual hard disk location. In the next exercise, you will configure

    additional settings so you should keep your virtual lab environment open.

    Create a Network Share for Storing Virtual Machines

    1. Sign in to LON-DC1-B by using the account Administrator with the password

    Pa55w.rd.

    2. On LON-DC1-B, in Server Manager, click File and Storage Services and then

    click Shares.

    3. In the Shares section, click Tasks, and then click New Share.

    4. In the New Share Wizard, on the Select the profile for this share page, in the

    File share profile section, click SMB Share – Applications, and then click Next.

    5. On the Select the server and path for this share page, click Next.

    6. On the Specify share name page, in Share name text box, type VHDs, and

    then click Next.

    7. On the Configure share settings page, click Next 2 times and on the

    Confirmation page, click Create.

    8. On the View results page, click Close.

  • 9. Create an additional share with the same settings where you use VMs as the

    Share name. Minimize Server Manager.

    Note: In a production environment, you would never use a domain controller to

    store the virtual machines and their virtual hard disks. You would use dedicated

    servers.

    Configure a Virtual Hard Disk Location

    1. Switch to LON-HOST1.

    2. On LON-HOST1, open Hyper-V Manager, start the New Virtual Hard Disk

    Wizard, and verify the default location for creating new virtual hard disks. In

    Hyper-V Manager, in the Actions pane, click New, and then click Hard Disk.

    3. In the New Virtual Hard Disk Wizard, click Next 3 times, examining your

    choices on each page. (Accept all the default settings).

    4. In the New Virtual Hard Disk Wizard, on the Specify Name and Location page,

    verify that the Location field is set to C:\Users\Public\Documents\Hyper-

    V\Virtual Hard Disks\, and then click Cancel.

    5. In Hyper-V Manager, confirm that the same location is set as the Virtual Hard

    Disk location in Hyper-V Settings under Actions.

    6. In Hyper-V Manager, set the Virtual Hard Disk location Hyper-V Settings to

    C:\Users, and confirm that this location is the default location when creating

    new virtual hard disks using the New Virtual Hard Disk Wizard.

    7. In Windows PowerShell, use Set-VMHost cmdlet with the VirtualHardDiskPath

    parameter to set virtual hard disk location to \\LON-DC1\VHDs.

    Set-VMHost -VirtualHardDiskPath \\LON-DC1\VHDs

    8. Use Hyper-V Manager to confirm that the Virtual Hard Disk location Hyper-V

    Setting is successfully set to \\LON-DC1\VHDs. You may need to close and

    open the Hyper-V Manager.

    Enable Resource Metering

  • 1. For this step, create a virtual machine. On LON-HOST1, use the New Virtual

    Machine Wizard in Hyper-V Manager to create a new virtual machine with the

    following settings (accept all other default settings). Take time to read

    through each selection.

    • Name: LON-VM1

    • Generation: Generation 2

    • Startup Memory: 1024 MB

    • Use Dynamic Memory: Enabled

    2. At the Windows PowerShell prompt, enter the following command to enable

    resource monitoring on the virtual machine you just created:

    Enable-VMResourceMetering LON-VM1

    Additional Hyper-V Configuration Options

    In this exercise, you will verify the default settings for the LON-HOST1 host in

    Hyper-V Manager, then make some changes to those settings using Windows

    PowerShell. You will reconfirm the changes in Hyper-V Manager.

    Confirm Hyper-V Settings for the Host Machine

    1. Sign in to LON-HOST1 by using the account Administrator with the password

    Pa55w.rd.

    2. In Server Manager, click Tools and then click Hyper-V Manager.

    3. In Hyper-V Manager, click LON-HOST1.

    4. In Hyper-V Manager, in the Actions pane, click Hyper-V Settings.

    5. On the Hyper-V Settings for LON-HOST1 page, in the left pane, click Virtual

    Machines, and in the details pane, in the text box, verify that

    C:\ProgramData\Microsoft\Windows\Hyper-V displays.

  • 6. On the Hyper-V Settings for LON-HOST1 page, in the left pane, click NUMA

    Spanning, and in the details pane, verify that NUMA Spanning is set to

    Enabled.

    7. In the left pane, click Storage Migrations, and verify that 2 simultaneous

    storage migrations are allowed.

    8. In the left pane, click Enhanced Session Mode Policy, and in the details pane,

    verify that Allow enhanced session mode is disabled.

    9. Close the Hyper-V Settings for LON-HOST1 page.

    10. Minimize Hyper-V Manager.

    Configure Hyper-V Settings using Windows PowerShell

    1. Click Start and then click the Windows PowerShell icon.

    2. In Windows PowerShell, run the following cmdlets. Press Enter at the end of

    each line:

    Set-VMHost -VirtualMachinePath \\LON-DC1\VMs

    Set-VMHost -NumaSpanningEnabled $false

    Set-VMHost -MaximumStorageMigrations 4

    Set-VMHost -EnableEnhancedSessionMode $true

    Note: You can ignore if a message appears that states that you must restart

    the Hyper-V Virtual Machine Management Service to apply the NUMA

    Spanning configuration.

    Reconfirm Hyper-V Settings using Hyper-V Manager

    1. Maximize Hyper-V Manager, and in the Actions pane, click Hyper-V Settings.

    2. On the Hyper-V Settings for LON-HOST1 page, click Virtual Machines, and

    verify that \\LON-DC1\VHDs is specified as the Virtual Machine location.

    Note: This is the location that you set using Windows PowerShell.

    3. In the left pane, click NUMA Spanning, and verify that NUMA Spanning is

    disabled.

    Note: NUMA Spanning is disabled because you set it to disabled using

    Windows PowerShell.

    4. In the right pane, select the check box to allow NUMA Spanning.

  • 5. In the left pane, click Storage Migrations, and then verify that the number of

    simultaneous storage migrations allowed is set to 4.

    Note: This value is set to 4 because you set the value using Windows

    PowerShell.

    6. In the left pane, click Enhanced Session Mode Policy, and verify that Policy is

    enabled. In the details pane, clear the Allow enhanced session mode check

    box to disable Enhanced Session Mode Policy.

    7. Click OK to close Hyper-V Settings for LON-HOST1.

    8. Ignore any messages to restart the machine because of changes to settings.

    Create Virtual Hard Disks

    In this exercise, you will create virtual hard disks using both the VHD and VHDX

    options.

    Note: Keep your virtual lab environment open as the subsequent exercise uses the

    virtual hard disks you just created in this one.

    Create Virtual Hard Disks

    1. Sign in to LON-HOST1 by using the account Administrator with the password

    Pa55w.rd.

    2. On LON-HOST1, click Start and then click Windows PowerShell.

    3. Use Hyper-V Manager to create a new virtual hard disk with the following

    settings:

    • Format: VHDX

    • Type: Dynamically expanding

    • Name: Dynamic.vhdx

    • Size: 100 GB

  • 4. Use Hyper-V Manager to create a new virtual hard disk with the following

    settings:

    • Format: VHD

    • Type: Differencing

    • Name: Differencing.vhd

    • Parent: E:\Program Files\Microsoft Learning\base\Base17C-WS16-

    1607.vhd

    Note: The actual drive letter on which base images are stored can be

    different and, it depends on the physical server configuration. Drive E is used

    in the instructions, but you should use the drive on which base images are

    stored in your environment.

    5. In Windows PowerShell, use the New-VHD cmdlet to create a new virtual

    hard disk with the following settings:

    • Path: \\LON-DC1\VHDs\Fixed.vhdx

    • Size: 1 GB

    • Type: Fixed size

    New-VHD -Path \\LON-DC1\VHDs\Fixed.vhdx -SizeBytes 1GB -Fixed

    Note: Keep your virtual lab environment open as the next two exercises use

    the virtual hard disks you just created in this one.

    Manage Virtual Hard Disks

    In this exercise, you will confirm different aspects of the virtual hard disks created

    in the previous exercise and perform a disk expansion.

  • Note: You will use the virtual hard disks that you created in the previous exercise.

    Explore Different Virtual Hard Disk Types

    1. Switch to LON-DC1 and if necessary sign in by using the account

    Adatum\Administrator with the password Pa55w.rd.

    2. On LON-DC1, on the taskbar, click File Explorer.

    3. In the File Explorer window, browse to the C:\Shares\VHDs folder.

    4. In the VHDs folder, right-click Fixed.vhdx, select Properties, confirm that its

    size on the disk is 1.00 GB, and then click OK.

    5. In the VHDs folder, verify that Dynamic.vhdx and Differencing.vhd are

    allocated much less space on the disk, even though you configured

    Dynamic.vhdx with 100 GB.

    Explore Different Virtual Hard Disk Types

    1. Switch to LON-HOST1.

    2. On LON-HOST1, in Hyper-V Manager, right-click LON-HOST1 and select Edit

    disk.

    3. As you go through the next steps take time to review the page information.

    4. Use the Edit Virtual Hard Disk Wizard to expand Fixed.vhdx to 2 GB.

    5. Use the Edit Virtual Hard Disk Wizard to expand Dynamic.vhdx to 200 GB.

    Note: Keep your lab session open so that you can complete the remaining

    exercises in this module.

  • Differencing Virtual Hard Disks

    In this exercise, you will create two differencing virtual hard disks and create a

    virtual machine connecting to one of the newly created differencing virtual hard

    disks.

    Note: This exercise continues from the previous one.

    Create Differencing Virtual Hard Disks

    1. Switch to LON-DC1.

    2. On LON-DC1, use File Explorer to create the following two folders:

    • C:\Shares\VMs\LON-VM3

    • C:\Shares\VMs\LON-VM4

    3. Switch to LON-HOST1.

    4. On LON-HOST1, in the Hyper-V Manager console, create a virtual hard disk

    with the following properties:

    • Disk Format: VHD

    • Disk Type: Differencing

    • Name: LON-VM3.vhd

    • Location: \\LON-DC1\VMs\LON-VM3

    • Parent Location: E:\Program Files\Microsoft Learning\base\Base17C-

    WS16-1607.vhd

    5. Open Windows PowerShell, and then execute the following command to

    create a new differencing virtual hard disk to be used with LON-VM4:

    New-VHD “\\LON-DC1\VMs\LON-VM4\LON-VM4.vhd” -ParentPath "

    E:\Program Files\Microsoft Learning\base\Base17C-WS16-1607.vhd"

  • 6. Verify that LON-VM4.vhd is configured as a differencing virtual hard disk with

    E:\Program Files\Microsoft Learning\base\Base17C-WS16-1607.vhd as a

    parent.

    7. Inspect the disk at \\LON-DC1\VMs\LON-VM4\LON-VM4.vhd.

    Create Virtual Machines

    1. On LON-HOST1, in the Hyper-V Manager console, in the Actions pane, click

    New, and then click Virtual Machine.

    2. Create a virtual machine with the following properties:

    • Name: LON-VM3

    • Location: \\LON-DC1\VMs\LON-VM3

    • Generation: Generation 1

    • Memory: 1024 MB

    • Use Dynamic Memory: Yes

    • Networking: Not Connected (will be the only option available due to

    the configuration of the lab environment).

    • Connect Virtual Hard Disk: \\LON-DC1\VMs\LON-VM3\LON-VM3.vhd

    3. Open Windows PowerShell, and then execute the following command:

    New-VM -Name LON-VM4 -Path “\\LON-DC1\VMs\LON-

    VM4” -MemoryStartupBytes 1024MB -VHDPath

    "\\LON-DC1\VMs\LON-VM4\LON-VM4.vhd"

    4. Use the Hyper-V Manager console to edit the settings of LON-VM3. In the

    Actions pane, under LON-VM3, click Settings. Configure the following

    settings:

    • Automatic Start Action: Nothing

    • Automatic Stop Action: Shut down the guest operating system

    Note: Keep your lab session open so that you can complete the remaining

    exercises in this module.

  • Enable Hyper-V Hardware Options

    In this exercise, you will create some virtual machines and enable and disable

    various hardware settings.

    Note: This exercise continues from the previous one, where you were instructed to

    keep the lab session open.

    Create Virtual Hard Disks

    1. On LON-HOST1, on the taskbar, click the Windows PowerShell icon.

    2. Use the Set-VMHost cmdlet to set the virtual hard disk path to

    C:\Shares\VHDs, and to set the virtual machine path to C:\Shares.

    Set-VMHost -VirtualHardDiskPath C:\Shares\VHDs

    Set-VMHost -VirtualMachinePath C:\Shares

    3. Use Hyper-V Manager to create a new virtual hard disk with the following

    settings:

    • Format: VHD

    • Type: Differencing

    • Name: Differencing.vhd

    • Parent: E:\Program Files\Microsoft Learning\base\Base14A-

    WS12R2.vhd

    Note: The actual drive letter on which base images are stored can be

    different and, it depends on the physical server configuration. Drive E is

    used in the instructions, but you should use the drive on which base

  • images are stored in your environment.

    Create Virtual Machines

    1. On LON-HOST1, in Windows PowerShell, create a Generation 1 virtual

    machine, and then attach it to a virtual hard disk by running the following

    cmdlets:

    New-VM -Name LON-VM2 -MemoryStartupBytes 1GB -Generation 1 -

    BootDevice IDE

    2. Use the Windows PowerShell cmdlet Add-VMHardDiskDrive to add the

    C:\Shares\VHDs\Differencing.vhd disk to the IDE Controller of LON-VM2.

    Add-VMHardDiskDrive -VMName LON-VM2 -ControllerType IDE -Path \\LON-

    DC1\VHDs\Differencing.vhd

    Configure Hardware Settings for Virtual Machines

    1. On LON-HOST1, in Hyper-V Manager, right-click the LON-VM1 virtual

    machine, and then click Settings.

    2. In Settings for LON-VM1, in the Add Hardware section, in the details pane,

    confirm that three types of hardware display. Confirm also that in the left

    pane, in the Hardware section where available hardware is listed, no BIOS,

    IDE Controllers, COM ports, or Diskette Drive display, but Firmware does

    display.

    3. In the Firmware section, click Hard Drive, click the Move Up icon to set Hard

    Drive as the first boot device, and then click OK.

    4. In the Hardware section, confirm in Security that Enable Secure Boot is

    enabled.

    5. In Hyper-V Manager, right-click the LON-VM2 virtual machine, and then click

    Settings.

    6. In Settings for LON-VM2, in the Add Hardware section, in the details pane,

    confirm that five types of hardware display. In the left pane, in the Hardware

  • section, confirm also that BIOS, IDE Controllers, COM ports, and Diskette

    Drive display, but Firmware does not display.

    7. Click BIOS, confirm that you can change Startup order.

    8. Click Security, confirm that no Enable Secure Boot option exists.

    9. Click Memory, and then confirm that Enable Dynamic Memory is not

    selected.

    10. In the left pane, in the Hardware section, confirm that a single Network

    Adapter displays, and then click OK.

    11. On LON-HOST1, in Windows PowerShell, enable dynamic memory, and then

    add a network adapter to the LON-VM2 virtual machine by running the

    following cmdlets:

    Set-VM -Name LON-VM2 -DynamicMemory

    Add-VMNetworkAdapter -VMName LON-VM2

    12. In Hyper-V Manager, right-click the LON-VM2 virtual machine, and then click

    Settings.

    13. In Settings for LON-VM2, click Memory, and then confirm that Enable

    Dynamic Memory is selected.

    14. In the left pane, in the Hardware section, confirm that two Network Adapters

    display, and then click OK.

    3 | Containers

    Install the Containers Feature and Docker

    In this exercise, you will install the Containers feature together with Docker.

    Afterwards you will verify that Docker is installed.

  • Note: A script is included at the end of this document. You can copy this script into

    the virtual environment using the instructions at the top of this document. You may

    want to run each command separately so you can see what is happening.

    Install Containers and Docker

    1. Sign in to LON-NVHOST2 by using the account Adatum\Administrator with

    the password Pa55w.rd.

    2. Click Start, right-click Windows PowerShell and then click Run as

    Administrator.

    3. In the next steps, be patient. Even though there may not be any prompts the

    install is proceeding. It will take about 1 minute.

    4. To install the OneGet Powershell module run the following command in the

    elevated Windows PowerShell window and when prompted type y to start

    the installation:

    Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

    5. To install the latest version of Docker run the following command in the

    same window and when prompted type y to start the installation:

    Install-Package -Name docker -ProviderName DockerMsftProvider

    6. Use Restart-Computer to finish the installation of Docker.

    Verify Containers and Docker installation

    1. Sign in to LON-NVHOST2 by using the account Adatum\Administrator with

    the password Pa55w.rd.

    2. In Server Manager, click Add Roles or Features.

    3. In the Add Roles or Features Wizard, click Next four times.

    4. On the Select features page, verify that the Containers feature is listed as

    installed. Cancel out of the wizard.

    5. Click Start, right-click Windows PowerShell and then click Run as

    Administrator.

  • 6. To verify that docker is installed, simply run the docker command. You

    should get a list of available docker commands.

    7. To verify which version of docker you are running, run the following

    command:

    docker version

    Note: Keep your virtual lab environment open as the subsequent exercise uses the

    virtual hard disks you just created in this one.

    Download and Start Container Images

    In this exercise, you will download container images and start containers based on

    these container images.

    Download container images and start containers

    1. Sign in to LON-NVHOST2 by using the account Adatum\Administrator with

    the password Pa55w.rd.

    2. Click Start, right-click Windows PowerShell and then click Run as

    Administrator.

    3. To start a sample .NET container image, run the following command:

    docker run microsoft/dotnet-samples:dotnetapp-nanoserver

    Note: If the command fails, retry the command after 1 minute.

    Note: The run command will run local images by default, if the image is not

    present, Docker will automatically download the container image and start a

    new container based on the container image. The download may take

    several minutes.

  • 4. To download a container image based on Windows Server Core run the

    following command:

    docker pull microsoft/windowsservercore

    Note: The pull command will take up to 30 minutes. Extracting the image

    afterwards takes an additional ten minutes.

    5. To start a container based on Microsoft/windowssserver core container

    image, run the following command:

    docker run microsoft/windowsservercore hostname

    Note: Hostname will be run when the container is started. It will be in the

    format of twelve random letters and numbers, e.q. 36bc5cfd2bf4.

    6. To download a container image with Internet Information Services (IIS)

    installed, run the following command:

    docker pull microsoft/iis

    Note: When the download begins, you should see some lines ending with

    Already exists. This is because the microsoft/iis image is based on the

    microsoft/windowsservercore image. So, this time the download will be

    relatively quick.

    7. To view a list of container images present locally on the computer, run the

    following command:

    docker images

    Note: You should see a list of three container images.

    Note: Keep your virtual lab environment open as the next exercise uses the virtual

    hard disks you just created in this one.

  • Build Container Images and Manage Containers

    In this exercise, you will build your own container image from a file and start a

    container. You will also stop and remove containers and remove container images

    in this exercise.

    Build container image using a dockerfile

    1. Sign in to LON-NVHOST2 by using the account Adatum\Administrator with

    the password Pa55w.rd.

    2. Click Start, right-click Windows PowerShell and then click Run as

    Administrator.

    3. Create a directory in the root of the C drive named docker.

    4. Start Notepad.

    5. Type the following text into Notepad and save the file as

    C:\docker\dockerfile:

    FROM microsoft/iis

    RUN echo “Hello World from container.” > c:\inetpub\wwwroot\index.html

    Note: Make sure that the file is properly named. If the file is named

    dockerfile.txt, the next commands will not work.

    6. To build a new container image start a sample .NET container image, run the

    following commands:

    cd c:\docker

    docker build -t testdockerid/iis-hello-world .

    Note: The run command will run local images by default, if the image is not

  • present, Docker will automatically download the container image and start a

    new container based on the container image. The download may take

    several minutes.

    7. Verify that you have created a new container image by running the following

    command:

    docker images

    Note: On the top of the list should be your newly created container image.

    8. To start a container based on your image, run the following command:

    docker run -p 80:80 testdockerid/iis-hello-world

    9. Press CTRL-C to return to the Windows PowerShell prompt.

    10. To view a list of the running containers, run the following command:

    docker ps -l

    Note: You should see the container you just started on the list. You can

    identify it using the IMAGE column. Make a note of the ContainerID.

    11. Use the ContainerID to obtain network information.

    docker inspect

  • 1. To stop the container you just started, run the following command:

    docker stop

    Note: After stop type the name assigned to your container. It is two random

    words with an underscore between the words, e.q. focused_lamarr. In this

    case, you stop the container by typing docker stop focused_lamarr.

    2. To remove the container, run the following command:

    docker rm

    Note: Again, use the custom assigned container name.

    3. To view the currently available images, run the following command:

    docker images

    4. To remove your own container image, run the following command:

    docker rmi testdockerid/iis-hello-world

    5. To verify that the container image has been removed, run the following

    command:

    docker images

    Note: Your container image should be gone from the list.

    This concludes the exercises in this module.

    Windows PowerShell starting script for the Docker exercises.

    #Install the OneGet PowerShell module

  • Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

    #Install the latest version of Docker

    Install-Package -Name docker -ProviderName DockerMsftProvider

    #Restart the computer

    Restart-Computer

    #Docker version and verify install

    docker version

    #Start a sample .NET container image

    docker run microsoft/dotnet-samples:dotnetapp-nanoserver

    #Download a container image based on Windows Server Core

    docker pull microsoft/windowsservercore

    #Start the container based on Windows Server Core

    docker run microsoft/windowsservercore hostname

    #Download a container with IIS

    docker pull microsoft/iis

    #Create the dockerfile

    #Build a new container

    cd c:\docker

    docker build -t testdockerid/iis-hello-world .

    #Start the container

    docker run -p 80:80 testdockerid/iis-hello-world

    Dockerfile

    FROM microsoft/iis

    RUN echo “Hello World from container.” > c:\inetpub\wwwroot\index.html