Commit 4a6725d7 authored by Stefan Scherer's avatar Stefan Scherer

Improve docker installation

parent 6b7863c1
packer build --only=vmware-iso --var iso_url=~/packer_cache/14300.1000.160324-1723.RS1_RELEASE_SVC_SERVER_OEMRET_X64FRE_EN-US.ISO windows_2016_docker.json
Write-Host "Enabling Docker unsecure port 2375"
Write-Host "Enabling Docker insecure port 2375"
if (!(Get-NetFirewallRule | where {$_.Name -eq "DockerUnsecure2375"})) {
New-NetFirewallRule -Name "DockerUnsecure2375" -DisplayName "Docker unsecure on TCP/2375" -Protocol tcp -LocalPort 2375 -Action Allow -Enabled True
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 unsecure port 2375"
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 '^docker daemon -D -b "Virtual Switch"$','docker daemon -D -b "Virtual Switch" -H'} | Set-Content C:\ProgramData\docker\runDockerDaemon.cmd
Sleep 2
wget -uri -OutFile C:\Install-ContainerHost.ps1
wget -OutFile c:\update-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.
......@@ -97,28 +100,13 @@ if (Test-Path a:\oracle-cert.cer) {
$installOptions = "-HyperV"
# Download latest nightly build of docker engine
$wantNightlyDocker = $false
if ($wantNightlyDocker) {
$ExeFile = "C:\Users\vagrant\Downloads\docker.exe"
wget -o $ExeFile
Run-Interactive -commandline "C:\Install-ContainerHost.ps1 $installOptions -DockerPath $ExeFile | Tee-Object -FilePath C:\progress.txt"
} else {
Run-Interactive -commandline "C:\Install-ContainerHost.ps1 $installOptions | Tee-Object -FilePath C:\progress.txt"
if ($installOptions) {
# install the windowsservercore image as well (w/o the -HyperV switch)
Run-Interactive -commandline "C:\Install-ContainerHost.ps1 -SkipDocker | Tee-Object -FilePath C:\progress.txt"
Run-Interactive -commandline "C:\update-containerhost.ps1 | Tee-Object -FilePath C:\progress.txt"
# tag the base images to latest if the tag got lost
if ("$(docker images windowsservercore:latest | wc -l)" -eq "1") {
docker tag windowsservercore:10.0.10586.0 windowsservercore:latest
if ($installOptions) {
if ("$(docker images nanoserver:latest | wc -l)" -eq "1") {
docker tag nanoserver:10.0.10586.0 nanoserver:latest
Run-Interactive -commandline "Install-ContainerImage -Name WindowsServerCore | Tee-Object -FilePath C:\progress.txt"
if (Test-Path a:\oracle-cert.cer) {
Write-Host "Skipping NanoServer container image"
} else {
Run-Interactive -commandline "Install-ContainerImage -Name NanoServer | Tee-Object -FilePath C:\progress.txt"
restart-service docker
# for debugging
# wait until a file has been removed from desktop
$file = "C:\users\vagrant\Desktop\delete-to-continue.txt"
if (-Not (Test-Path $file)) {
Write-Host "Remove me" | Out-File $file
Write-Host "Wait until someone removes $file"
while (Test-Path $file) {
Sleep 1
Write-Host "Done waiting!"
......@@ -102,7 +102,7 @@
"type": "powershell",
"scripts": [
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