Skip to content

Commit

Permalink
Adjust Docker installation for Win10 and Win2016
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanScherer committed Feb 12, 2017
1 parent e88b13e commit 15ea66b
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 28 deletions.
10 changes: 5 additions & 5 deletions build_windows_10.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#packer build --only=vmware-iso windows_10.json

# my own license
#packer build --only=vmware-iso --var iso_url=~/packer_cache/Win10_1607_English_x64.iso --var iso_checksum=99fd8082a609997ae97a514dca22becf20420891 --var autounattend=./tmp/10/Autounattend.xml windows_10.json

# Windows 10 Insider 15002
# packer build --only=vmware-iso --var iso_url=~/packer_cache/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_15002.iso --var iso_checksum=86fdf5c4061edde17a6aece0590225e6880b39ee --var autounattend=./tmp/10_insider/Autounattend.xml windows_10.json
# Windows 10 Pro own license
#packer build --only=vmware-iso --var iso_url=~/packer_cache/my/Win10_1607_English_x64.iso --var iso_checksum=99fd8082a609997ae97a514dca22becf20420891 --var autounattend=./tmp/10_pro/Autounattend.xml windows_10.json

# Windows 10 Insider 15025
packer build --only=vmware-iso --var iso_url=~/packer_cache/Windows10_InsiderPreview_EnterpriseVL_x64_en-us_15025.iso windows_10_insider.json

# Windows 10 Enterprise MSDN
#packer build --only=vmware-iso --var iso_url=~/packer_cache/msdn/en_windows_10_enterprise_version_1607_updated_jan_2017_x64_dvd_9714415.iso --var iso_checksum=97164DD5C1C933BAEF89A4BDE93D544256134FE4 --var iso_checksum_type=sha1 --var autounattend=./tmp/10/Autounattend.xml windows_10.json
4 changes: 3 additions & 1 deletion build_windows_2016_docker.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash
# packer build --only=vmware-iso --var iso_url=~/packer_cache/14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO windows_2016_docker.json
packer build --only=vmware-iso --var iso_url=~/packer_cache/en_windows_server_2016_x64_dvd_9327751.iso --var iso_checksum=91d7b2ebcff099b3557570af7a8a5cd6 --var autounattend=./tmp/2016/Autounattend.xml windows_2016_docker.json

# MSDN ISO
packer build --only=vmware-iso --var iso_url=~/packer_cache/msdn/en_windows_server_2016_x64_dvd_9718492.iso --var iso_checksum=F185197AF68FAE4F0E06510A4579FC511BA27616 --var iso_checksum_type=sha1 --var autounattend=./tmp/2016_noupdate/Autounattend.xml windows_2016_docker.json
Original file line number Diff line number Diff line change
@@ -1,4 +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
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
Set-ExecutionPolicy Bypass -scope Process
New-Item -Type Directory -Path "$($env:ProgramFiles)\docker"
# wget -outfile $env:TEMP\docker-1.13.1.zip "https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-13-1.zip"
Write-Host "Downloading docker ..."
wget -outfile $env:TEMP\docker-1.13.1.zip "https://get.docker.com/builds/Windows/x86_64/docker-1.13.1.zip"
Expand-Archive -Path $env:TEMP\docker-1.13.1.zip -DestinationPath $env:TEMP -Force
copy $env:TEMP\docker\*.exe $env:ProgramFiles\docker
Remove-Item $env:TEMP\docker-1.13.1.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

Write-Host "Fix --restart=always for reboot ..."
# see https://github.com/docker/docker/issues/27544
& sc.exe config Docker depend= LanmanWorkstation

Start-Service Docker
9 changes: 9 additions & 0 deletions scripts/docker/2016/install-containers-feature.ps1
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions scripts/docker/2016/install-docker.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$ProgressPreference = 'SilentlyContinue'

Set-ExecutionPolicy Bypass -scope Process
New-Item -Type Directory -Path "$($env:ProgramFiles)\docker"
wget -outfile $env:TEMP\docker-1.13.1.zip "https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-13-1.zip"
Expand-Archive -Path $env:TEMP\docker-1.13.1.zip -DestinationPath $env:TEMP -Force
copy $env:TEMP\docker\*.exe $env:ProgramFiles\docker
Remove-Item $env:TEMP\docker-1.13.1.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
2 changes: 1 addition & 1 deletion scripts/docker/docker-pull-async.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function DockerPull {

Write-Host Installing $image ...
$j = Start-Job -ScriptBlock { docker pull $args[0] } -ArgumentList $image
while ( $j.JobStateInfo.state -ne "Completed" ) {
while ( $j.JobStateInfo.state -ne "Completed" -And $j.JobStateInfo.state -ne "Failed" ) {
Write-Host $j.JobStateInfo.state
Start-Sleep 10
}
Expand Down
12 changes: 2 additions & 10 deletions scripts/docker/enable-winrm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@ 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"}'
# Set-Service winrm -startuptype "auto"
# Restart-Service winrm

Write-Host "Install Containers"
Install-WindowsFeature -Name Containers

if ((GWMI Win32_Processor).VirtualizationFirmwareEnabled[0] -and (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions[0]) {
Write-Host "Install Hyper-V"
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools
} else {
Write-Host "Skipping installation of Hyper-V"
if (Test-Path A:\install-containers-feature.ps1) {
. A:\install-containers-feature.ps1
}

Stop-Service winrm
Expand Down
2 changes: 0 additions & 2 deletions scripts/docker/install-containers-feature.ps1

This file was deleted.

6 changes: 3 additions & 3 deletions windows_10_docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{
"type": "powershell",
"scripts": [
"./scripts/docker/install-containers-feature-windows10.ps1"
"./scripts/docker/10/install-containers-feature.ps1"
]
},
{
Expand All @@ -35,9 +35,8 @@
{
"type": "powershell",
"scripts": [
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/add-docker-group.ps1",
"./scripts/docker/install-docker.ps1",
"./scripts/docker/10/install-docker.ps1",
"./scripts/docker/docker-pull-async.ps1",
"./scripts/docker/open-docker-insecure-port.ps1",
"./scripts/docker/remove-docker-key-json.ps1",
Expand All @@ -48,6 +47,7 @@
"type": "windows-shell",
"scripts": [
"./scripts/uac-enable.bat",
"./scripts/set-winrm-automatic.bat",
"./scripts/compact.bat"
]
}
Expand Down
5 changes: 4 additions & 1 deletion windows_2016_docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
Expand Down Expand Up @@ -55,6 +56,7 @@
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
Expand Down Expand Up @@ -91,6 +93,7 @@
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/docker/enable-winrm.ps1",
"./scripts/docker/2016/install-containers-feature.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1",
"./scripts/oracle-cert.cer"
Expand Down Expand Up @@ -141,7 +144,7 @@
"type": "powershell",
"scripts": [
"./scripts/docker/add-docker-group.ps1",
"./scripts/docker/install-docker.ps1",
"./scripts/docker/2016/install-docker.ps1",
"./scripts/docker/docker-pull-async.ps1",
"./scripts/docker/open-docker-insecure-port.ps1",
"./scripts/docker/remove-docker-key-json.ps1",
Expand Down

0 comments on commit 15ea66b

Please sign in to comment.