7. Creating Nano Server Containers

This command relies on a pre-created CSV for the container (see Managing Persistent Storage Volumes). You can also create a persistent volume along with the container. To do this, replace the --filesystem parameter with --disk pool=<UUID>,size=<N>, e.g., --disk pool=27a0ce77,size=3 (the size is in gibibytes). The volume name will automatically match the container name.

  1. Create a Windows container based on the Nano Server image:

    $ virt-install --connect docker://node3.winctpreview.com --name vpnclient<N>_winct03nano --memory 512 --boot init=* --os-variant none --console none --disk bus=virtio,path=mcr.microsoft.com/windows/nanoserver:1809 --network type=network,mac=C4:37:72:75:<XX>:<YY>,source=vSwitch1 --filesystem C:/ClusterStorage/CSV_vpnclient<N>_winct03nano/,C:/Data/ --noreboot --noautoconsole
    Starting install...
    Domain creation completed.
    You can restart your domain by running:
    virsh --connect docker://node3.winctpreview.com start vpnclient<N>_winct03nano
    

    This command creates the following container:

    • Location: node3.winctpreview.com
    • Name: vpnclient<N>_winct03nano. The name must be unique on the node. For ease of filtering, replace vpnclient<N> here and everywhere else with your username.
    • MAC: C4:37:72:75:<XX>:<YY>. To avoid MAC conflicts, replace <XX> and <YY> with the number from your username and container index, respectively. For example, C4:37:72:75:01:03 if your username is vpnclient1 this is the third container you create.
    • RAM: 512MB
    • Network: DHCP from the virtual switch vSwitch1
    • Persistent storage: C:\\ClusterStorage\\CSV_vpnclient<N>_winct03nano\\
    • Base image: mcr.microsoft.com/windows/nanoserver:1809
  2. Start the container:

    $ virsh --connect docker://node3.winctpreview.com start vpnclient<N>_winct03nano
    Domain vpnclient<N>_winct03nano started
    
  3. Find out the container IP address. For example:

    $ /usr/share/winrm-docker-deploy/run-win-cmd node3.winctpreview.com vpnclient<N>_winct03nano cmd /c 'ipconfig | find "IPv4"'
    node3.winctpreview.com: cmd /c ipconfig | find "IPv4"
    IPv4 Address. . . . . . . . . . . : 10.37.130.173
    

    If you get 169.254.<...>, the container is still waiting for an IP address from DHCP. Please run the command again in a minute.

You can now run commands inside the container as explained in Running Commands in Containers.