Commit dad62f2f authored by Stefan Scherer's avatar Stefan Scherer

Merge pull request #5 from StefanScherer/tp5

Update docker to TP5
parents fab0ac8f b1d58be9
......@@ -51,7 +51,7 @@
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME </Key>
<Value>Windows Server 2016 Technical Preview 4 SERVERDATACENTER</Value>
<Value>Windows Server 2016 Technical Preview 5 SERVERDATACENTER</Value>
</MetaData>
</InstallFrom>
<InstallTo>
......@@ -61,11 +61,11 @@
</OSImage>
</ImageInstall>
<UserData>
<!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
<!-- Product Key from https://www.microsoft.com/de-de/evalcenter/evaluate-windows-server-technical-preview?i=1 -->
<ProductKey>
<!-- Do not uncomment the Key element if you are using trial ISOs -->
<!-- You must uncomment the Key element (and optionally insert your own key) if you are using retail or volume license ISOs -->
<!--<Key>D2N9P-3P6X9-2R39C-7RTCD-MDVJX</Key>-->
<Key>6XBNX-4JQGW-QX6QG-74P76-72V67</Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
......
#!/bin/bash
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 "WARNING: DO NOT USE DOCKER IN PRODUCTION WITHOUT TLS"
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 0.0.0.0:2375'} | Set-Content C:\ProgramData\docker\runDockerDaemon.cmd
......
Sleep 2
# https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/inplace_setup
wget -uri https://aka.ms/tp4/Install-ContainerHost -OutFile C:\Install-ContainerHost.ps1
# https://msdn.microsoft.com/virtualization/windowscontainers/deployment/deployment
wget https://aka.ms/tp5/Update-Container-Host -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 https://master.dockerproject.org/windows/amd64/docker.exe
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"
}
# https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/manage_docker
restart-service docker
# Workaround for slow exiting containers:
# https://social.msdn.microsoft.com/Forums/en-US/e2751260-4494-4b60-999e-5ea27ccbe1db/workaround-to-increase-boot-time-for-windows-server-core-containers?forum=windowscontainers
Write-Host "Running windowsservercore once and tagging it as latest"
# Remove containers
if ($((docker ps -aq | Measure-Object -Line).Lines) -gt 0) {
docker rm -f $(docker ps -aq)
}
# Untag if present
if ($((docker images | where { $_ -match "windowsservercore" } | where { $_ -match "latest" } | Measure-Object -Line).Lines) -gt 0) {
docker rmi windowsservercore:latest
}
# Find the build
$build=docker images | where { $_ -match "windowsservercore" } | %{ $_.Split(' ')[3]; }
# Run a container once
docker run windowsservercore:$build cmd /s /c echo windowsservercore has started once
# Commit the container
$containerID=$(docker ps -aq)
$imageID=$(docker commit $containerID | %{ $_.Split(':')[1] })
docker tag $imageID windowsservercore:latest
# Remove the temporary container
docker rm $containerID
......@@ -15,7 +15,7 @@ if exist "C:\Users\vagrant\windows.iso" (
)
if not exist "C:\Windows\Temp\windows.iso" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.1.0/3272444/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.1.1/3770994/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"
FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso"
rd /S /Q "C:\Program Files (x86)\VMWare"
......
# 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,8 @@
"type": "powershell",
"scripts": [
"./scripts/install-docker.ps1",
"./scripts/enable-docker-unsecure.ps1"
"./scripts/patch-boot-time-for-containers.ps1",
"./scripts/enable-docker-insecure.ps1"
]
},
{
......@@ -123,9 +124,9 @@
}
],
"variables": {
"iso_url": "https://aka.ms/tp4/serveriso",
"iso_url": "https://aka.ms/tp5/serveriso",
"iso_checksum_type": "md5",
"iso_checksum": "935ba77651210bd1bd71a114c92b0caa",
"iso_checksum": "6417ba460f95bd91ded05dfacd553783",
"autounattend": "./answer_files/2016/Autounattend.xml",
"product_key": "<tab>"
}
......
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