Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Demo code used in Twin Cities PowerShell Automation presentation
# What I followed to do containers (Microsoft's Quickstart Guide):
# https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quickstart
break
# Run on Server Core 2016 TP3
Start-Process PowerShell -Verb runAs
mkdir c:\scripts
wget -uri http://aka.ms/setupcontainers -OutFile c:\scripts\containersetup.ps1
c:\scripts\containersetup.ps1 #This script took ~50 minutes, but downloads/installs Docker too
### USING POWERSHELL ###
# View all cmdlets/functions from Containers Module
Get-Command -Module Containers
#Take note of the IP Address you will use
ipconfig
#Take note of the WIM that you will use
$WIM = Get-ContainerImage
$VMSwitch = Get-VMSwitch
$Container = New-Container -Name "TCPoSH1" -ContainerImage $WIM -SwitchName "$($VMSwitch.Name)"
Get-Container
Start-Container $Container
# You can interact with containers via Remoting commands, as usual
Enter-PSSession -ContainerId $Container.ContainerId -RunAsAdministrator
ipconfig #Check it out
# DOCKER
docker
docker search windows
docker pull microsoft/iis
docker run -it --name iisdemo microsoft/iis powershell
docker ps -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment