Saturday, 4 June 2016

Manage Windows containers

Posted by: Ashwin Venugopal

Creating containers

  1. Create a container base image.
    1. New-Container -Name TestContainer -ContainerImageName WindowsServerCore
    2. The preceding cmdlet creates a container called TestContainer and bases it on the WindowsServerCore container base image.
  2. Add a network adapter to your image
    1. Add-ContainerNetworkAdapter -ContainerName TestContainer
    2. Connect-ContainerNetworkAdapter -ContainerName TestContainer -SwitchName switchname
      1. To get the list of available virtual switches
        1. Get-VMswitch
Starting containers

  1. $container = Get-Container -Name TestContainer
  2. Start-container $container


Connecting to containers

  1. Enter-PSSession -ContainerName TestContainer –RunAsAdministrator

Stopping containers

  1. $container = Get-Container -Name TestContainer
  2. Stop-container $container


Removing containers

  1. $container = Get-Container -Name TestContainer
  2. Remove-container $container -force

Thanks for reading.

No comments:

Post a Comment