Initial commit

This commit is contained in:
Chris Long
2017-12-11 08:49:25 -08:00
commit 1577341ce9
157 changed files with 5271 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
# https://msdn.microsoft.com/de-de/virtualization/windowscontainers/quick_start/quick_start_windows_10
Write-Host "Install Containers feature"
Enable-WindowsOptionalFeature -Online -FeatureName containers -All -NoRestart
Write-Host "Install Hyper-V feature"
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
sc.exe config winrm start= delayed-auto

View File

@@ -0,0 +1,13 @@
Set-ExecutionPolicy Bypass -scope Process
New-Item -Type Directory -Path "$($env:ProgramFiles)\docker"
# wget -outfile $env:TEMP\docker-17.03.0-ce.zip "https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-13-1.zip"
Write-Host "Downloading docker ..."
wget -outfile $env:TEMP\docker-17.03.0-ce.zip "https://get.docker.com/builds/Windows/x86_64/docker-17.03.0-ce.zip"
Expand-Archive -Path $env:TEMP\docker-17.03.0-ce.zip -DestinationPath $env:TEMP -Force
copy $env:TEMP\docker\*.exe $env:ProgramFiles\docker
Remove-Item $env:TEMP\docker-17.03.0-ce.zip
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$($env:ProgramFiles)\docker", [EnvironmentVariableTarget]::Machine)
$env:Path = $env:Path + ";$($env:ProgramFiles)\docker"
Write-Host "Registering docker service ..."
. dockerd --register-service -H npipe:// -H 0.0.0.0:2375 -G docker
Start-Service Docker

View File

@@ -0,0 +1,9 @@
Write-Host "Install Containers feature"
Install-WindowsFeature -Name Containers
if ((GWMI Win32_Processor).VirtualizationFirmwareEnabled[0] -and (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions[0]) {
Write-Host "Install Hyper-V feature"
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools
} else {
Write-Host "Skipping installation of Hyper-V feature"
}

View File

@@ -0,0 +1,12 @@
$ProgressPreference = 'SilentlyContinue'
Set-ExecutionPolicy Bypass -scope Process
New-Item -Type Directory -Path "$($env:ProgramFiles)\docker"
wget -outfile $env:TEMP\docker-17-03-0-ee.zip "https://dockermsft.blob.core.windows.net/dockercontainer/docker-17-03-0-ee.zip"
Expand-Archive -Path $env:TEMP\docker-17-03-0-ee.zip -DestinationPath $env:TEMP -Force
copy $env:TEMP\docker\*.exe $env:ProgramFiles\docker
Remove-Item $env:TEMP\docker-17-03-0-ee.zip
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$($env:ProgramFiles)\docker", [EnvironmentVariableTarget]::Machine)
$env:Path = $env:Path + ";$($env:ProgramFiles)\docker"
. dockerd --register-service -H npipe:// -H 0.0.0.0:2375 -G docker
Start-Service docker

View File

@@ -0,0 +1,5 @@
Write-Host Creating group docker
net localgroup docker /add
$username = $env:USERNAME
Write-Host Adding user $username to group docker
net localgroup docker $username /add

View File

@@ -0,0 +1 @@
Set-MpPreference -DisableRealtimeMonitoring $true

View File

@@ -0,0 +1,16 @@
function DockerPull {
Param ([string]$image)
Write-Host Installing $image ...
$j = Start-Job -ScriptBlock { docker pull $args[0] } -ArgumentList $image
while ( $j.JobStateInfo.state -ne "Completed" -And $j.JobStateInfo.state -ne "Failed" ) {
Write-Host $j.JobStateInfo.state
Start-Sleep 10
}
$results = Receive-Job -Job $j
$results
}
DockerPull microsoft/windowsservercore
DockerPull microsoft/nanoserver

View File

@@ -0,0 +1,21 @@
Enable-PSRemoting -Force
winrm quickconfig -q
winrm quickconfig -transport:http
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="800"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/client/auth '@{Basic="true"}'
winrm set winrm/config/listener?Address=*+Transport=HTTP '@{Port="5985"}'
if (Test-Path A:\install-containers-feature.ps1) {
. A:\install-containers-feature.ps1
}
Stop-Service winrm
. sc.exe config winrm start= delayed-auto
netsh advfirewall firewall set rule group="Windows Remote Administration" new enable=yes
netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" new enable=yes action=allow
Restart-Computer

View File

@@ -0,0 +1,6 @@
Write-Host "WARNING: DO NOT USE DOCKER IN PRODUCTION WITHOUT TLS"
Write-Host "Opening Docker insecure port 2375"
if (!(Get-NetFirewallRule | where {$_.Name -eq "Dockerinsecure2375"})) {
New-NetFirewallRule -Name "Dockerinsecure2375" -DisplayName "Docker insecure on TCP/2375" -Protocol tcp -LocalPort 2375 -Action Allow -Enabled True
}

View File

@@ -0,0 +1,9 @@
# Do not restart Docker as it creates the key.json with an unique ID
# This should not exist in the Vagrant basebox so you can spin up
# multiple Vagrant boxes for a Docker swarm etc.
Write-Host "Stopping Docker"
Stop-Service docker
Write-Host "Removing key.json to recreate key.json on first vagrant up"
rm C:\ProgramData\docker\config\key.json