VirtualMetric Hyper-V Monitoring, Hyper-V Reporting


Cozumpark Bilisim Portali
Posted in Windows Powershell, Windows Server | No Comment | 1,908 views | 04/10/2015 20:22

Windows Containers are finally here! Lets start our new series :)

Container management is very similar to Hyper-V management. For example:


Lets check our commands:

PS C:\Users\Administrator> get-command *container*
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Install-ContainerOSImage                     Containers
Function        Uninstall-ContainerOSImage                   Containers
Cmdlet          Add-ContainerNetworkAdapter                  Containers
Cmdlet          Connect-ContainerNetworkAdapter              Containers
Cmdlet          Disconnect-ContainerNetworkAdapter           Containers
Cmdlet          Export-ContainerImage                        Containers
Cmdlet          Get-Container                                Containers
Cmdlet          Get-ContainerHost                            Containers
Cmdlet          Get-ContainerImage                           Containers
Cmdlet          Get-ContainerNetworkAdapter                  Containers
Cmdlet          Import-ContainerImage                        Containers
Cmdlet          Move-ContainerImageRepository                Containers
Cmdlet          New-Container                                Containers
Cmdlet          New-ContainerImage                           Containers
Cmdlet          Remove-Container                             Containers
Cmdlet          Remove-ContainerImage                        Containers
Cmdlet          Remove-ContainerNetworkAdapter               Containers
Cmdlet          Set-ContainerNetworkAdapter                  Containers
Cmdlet          Start-Container                              Containers
Cmdlet          Stop-Container                               Containers
Cmdlet          Test-ContainerImage                          Containers

I can create a new container with following command:

New-Container -Name "MyContainer" -ContainerImageName WindowsServerCore -SwitchName "Virtual Switch"

If you install Windows Containers with Microsoft Documentation, then you should have a virtual switch called “Virtual Switch” in your environment.

New-Container accepts many parameters:

    New-Container [[-Name] <string>] -ContainerImageName <string> [-ContainerImagePublisher <string>]
    [-ContainerImageVersion <version>] [-CimSession <CimSession[]>] [-ComputerName <string[]>] [-Credential
    <pscredential[]>] [-MemoryStartupBytes <long>] [-SwitchName <string>] [-Path <string>] [-AsJob] [-WhatIf]
    [-Confirm]  [<CommonParameters>]
    New-Container [[-Name] <string>] -ContainerImage <ContainerImage> [-MemoryStartupBytes <long>] [-SwitchName
    <string>] [-Path <string>] [-AsJob] [-WhatIf] [-Confirm]  [<CommonParameters>]

There is a parameter called “MemoryStartupBytes” but it seems it just changes startup memory. It seems there is no memory or processor limit yet.


Starting Container is similar like Hyper-V VMs:

Start-Container -Name "MyContainer"

After start your container, you should configure your Host’s Firewall because Container uses Host Firewall. If you try to configure firewall inside Container, you will get warning.

You can use Enter-PSSession like in Hyper-V VMs to connect Container:

Enter-PSSession -ContainerId (Get-Container MyContainer).ContainerId -RunAsAdministrator

You can disable firewall with following command to test RDP connection:

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

After that, you may have to enable Administrator account in Container with:

net use administrator /active:yes
net use administrator Password1!

See you in next part!