Commit e454900f authored by Patrick Lang's avatar Patrick Lang

Moving to newer install process

parent 7e13d479
......@@ -191,7 +191,7 @@
-->
<!-- END WITHOUT WINDOWS UPDATES -->
<!-- WITH WINDOWS UPDATES -->
<SynchronousCommand wcm:action="add">
<!-- <SynchronousCommand wcm:action="add">
<CommandLine>cmd.exe /c a:\microsoft-updates.bat</CommandLine>
<Order>98</Order>
<Description>Enable Microsoft Updates</Description>
......@@ -201,7 +201,7 @@
<Description>Install Windows Updates</Description>
<Order>100</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
</SynchronousCommand> -->
<!-- END WITH WINDOWS UPDATES -->
</FirstLogonCommands>
<OOBE>
......
Write-Host "WARNING: DO NOT USE DOCKER IN PRODUCTION WITHOUT TLS"
Write-Host "Enabling Docker insecure port 2375"
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
}
Write-Host "Enabling Docker to listen on insecure port 2375"
cp C:\ProgramData\docker\runDockerDaemon.cmd C:\ProgramData\docker\runDockerDaemon.cmd.bak
cat C:\ProgramData\docker\runDockerDaemon.cmd.bak | %{$_ -replace '^dockerd -H npipe://\s*$','dockerd -H npipe:// -H 0.0.0.0:2375'} | Set-Content C:\ProgramData\docker\runDockerDaemon.cmd
......@@ -12,6 +12,8 @@ winrm set winrm/config/listener?Address=*+Transport=HTTP '@{Port="5985"}'
Write-Host "Install Containers"
Install-WindowsFeature -Name Containers
# TODO: Better option - use msinfo32 or coreinfo to see if virtualization instructions are supported
if (Test-Path a:\oracle-cert.cer) {
Write-Host "Skipping installation of Hyper-V in VirtualBox basebox"
} else {
......
# https://msdn.microsoft.com/virtualization/windowscontainers/deployment/deployment
wget https://aka.ms/tp5/Install-ContainerHost -OutFile c:\Install-ContainerHost.ps1 -UseBasicParsing
Install-PackageProvider ContainerImage -Force
# create a Task Scheduler task which is also able to run in battery mode due
# to host notebooks working in battery mode.
function Run-Interactive {
param( [string] $commandline)
$xml = @"
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2014-03-27T13:53:05</Date>
<Author>vagrant</Author>
</RegistrationInfo>
<Triggers>
<TimeTrigger>
<StartBoundary>2014-03-27T00:00:00</StartBoundary>
<Enabled>true</Enabled>
</TimeTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>vagrant</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>powershell.exe</Command>
<Arguments>-Command $commandline ; sleep 15</Arguments>
</Exec>
</Actions>
</Task>
"@
$XmlFile = $env:Temp + "\InstallContainerHost.xml"
Write-Host "Write Task '$commandline' to $XmlFile"
$xml | Out-File $XmlFile
& schtasks /Delete /F /TN InstallContainerHost
& schtasks /Create /TN InstallContainerHost /XML $XmlFile
& schtasks /Run /TN InstallContainerHost
Write-Host "Waiting until Scheduled Task InstallContainerHost task is no longer running"
do {
Start-Sleep -Seconds 5
} while ( (& schtasks /query /tn InstallContainerHost | Select-String -Pattern "InstallContainerHost" -SimpleMatch) -like "*Running*")
if ((& schtasks /query /tn InstallContainerHost | Select-String -Pattern "InstallContainerHost" -SimpleMatch) -like "*Could not start*") {
Write-Error "Scheduled Task InstallContainerHost could not start!"
} else {
Write-Host "Scheduled Task InstallContainerHost '$commandline' finished"
}
cat C:\progress.txt
$halt = 0
if ($halt) {
Write-Host "Delete me to continue" | Out-File -FilePath $env:USERPROFILE\Desktop\deleteme.txt
Write-Host "Pausing until $env:USERPROFILE\Desktop\deleteme.txt gets deleted"
do {
Start-Sleep -Seconds 5
} while (Test-Path $env:USERPROFILE\Desktop\deleteme.txt)
}
& schtasks /Delete /F /TN InstallContainerHost
}
if (Test-Path a:\oracle-cert.cer) {
Write-Host "Skip installation of Hyper-V on VirtualBox Container Host"
$installOptions = ""
} else {
Write-Host "Add installation of Hyper-V on Container Host"
$installOptions = "-HyperV"
}
if (Test-Path a:\oracle-cert.cer) {
Write-Host "Skipping NanoServer container image"
} else {
Run-Interactive -commandline "C:\Install-ContainerHost.ps1 -HyperV | Tee-Object -FilePath C:\progress.txt"
}
Run-Interactive -commandline "C:\Install-ContainerHost.ps1 | Tee-Object -FilePath C:\progress.txt"
restart-service docker
# https://msdn.microsoft.com/de-de/virtualization/windowscontainers/quick_start/quick_start_windows_10
New-Item -Type Directory -Path 'C:\Program Files\docker\'
Invoke-WebRequest https://aka.ms/tp5/b/dockerd -OutFile $env:ProgramFiles\docker\dockerd.exe
Invoke-WebRequest https://aka.ms/tp5/b/docker -OutFile $env:ProgramFiles\docker\docker.exe
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Docker", [EnvironmentVariableTarget]::Machine)
. 'C:\Program Files\docker\dockerd' --register-service -H npipe:// -H 0.0.0.0:2375
Start-Service Docker
......@@ -134,7 +134,6 @@
"type": "powershell",
"scripts": [
"./scripts/docker/install-docker.ps1",
"./scripts/docker/patch-boot-time-for-containers.ps1",
"./scripts/docker/enable-docker-insecure.ps1",
"./scripts/docker/add-docker-group.ps1",
"./scripts/docker/remove-docker-key-json.ps1"
......@@ -143,7 +142,6 @@
{
"type": "windows-shell",
"scripts": [
"./scripts/set-winrm-automatic.bat",
"./scripts/uac-enable.bat",
"./scripts/compile-dotnet-assemblies.bat",
"./scripts/compact.bat"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment