Skip to content

Instantly share code, notes, and snippets.

@ScriptAutomate
Last active October 16, 2015 03:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ScriptAutomate/1179b2db1619ce96fcd4 to your computer and use it in GitHub Desktop.
Save ScriptAutomate/1179b2db1619ce96fcd4 to your computer and use it in GitHub Desktop.
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