Initial commit
This commit is contained in:
6
Packer/scripts/docker/10/install-containers-feature.ps1
Executable file
6
Packer/scripts/docker/10/install-containers-feature.ps1
Executable 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
|
||||
13
Packer/scripts/docker/10/install-docker.ps1
Executable file
13
Packer/scripts/docker/10/install-docker.ps1
Executable 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
|
||||
9
Packer/scripts/docker/2016/install-containers-feature.ps1
Executable file
9
Packer/scripts/docker/2016/install-containers-feature.ps1
Executable 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"
|
||||
}
|
||||
12
Packer/scripts/docker/2016/install-docker.ps1
Executable file
12
Packer/scripts/docker/2016/install-docker.ps1
Executable 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
|
||||
5
Packer/scripts/docker/add-docker-group.ps1
Executable file
5
Packer/scripts/docker/add-docker-group.ps1
Executable 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
|
||||
1
Packer/scripts/docker/disable-windows-defender.ps1
Executable file
1
Packer/scripts/docker/disable-windows-defender.ps1
Executable file
@@ -0,0 +1 @@
|
||||
Set-MpPreference -DisableRealtimeMonitoring $true
|
||||
16
Packer/scripts/docker/docker-pull-async.ps1
Executable file
16
Packer/scripts/docker/docker-pull-async.ps1
Executable 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
|
||||
21
Packer/scripts/docker/enable-winrm.ps1
Executable file
21
Packer/scripts/docker/enable-winrm.ps1
Executable 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
|
||||
6
Packer/scripts/docker/open-docker-insecure-port.ps1
Executable file
6
Packer/scripts/docker/open-docker-insecure-port.ps1
Executable 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
|
||||
}
|
||||
9
Packer/scripts/docker/remove-docker-key-json.ps1
Executable file
9
Packer/scripts/docker/remove-docker-key-json.ps1
Executable 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
|
||||
Reference in New Issue
Block a user