diff --git a/build_windows_10.sh b/build_windows_10.sh index 87ba986b..6e537038 100755 --- a/build_windows_10.sh +++ b/build_windows_10.sh @@ -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 diff --git a/build_windows_2016_docker.sh b/build_windows_2016_docker.sh index 7f9dcb9f..8a90b405 100755 --- a/build_windows_2016_docker.sh +++ b/build_windows_2016_docker.sh @@ -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 diff --git a/scripts/docker/install-containers-feature-windows10.ps1 b/scripts/docker/10/install-containers-feature.ps1 similarity index 79% rename from scripts/docker/install-containers-feature-windows10.ps1 rename to scripts/docker/10/install-containers-feature.ps1 index 3fb76698..2105357d 100644 --- a/scripts/docker/install-containers-feature-windows10.ps1 +++ b/scripts/docker/10/install-containers-feature.ps1 @@ -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 diff --git a/scripts/docker/install-docker.ps1 b/scripts/docker/10/install-docker.ps1 similarity index 83% rename from scripts/docker/install-docker.ps1 rename to scripts/docker/10/install-docker.ps1 index 6c5eeddd..18ebae24 100644 --- a/scripts/docker/install-docker.ps1 +++ b/scripts/docker/10/install-docker.ps1 @@ -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 diff --git a/scripts/docker/2016/install-containers-feature.ps1 b/scripts/docker/2016/install-containers-feature.ps1 new file mode 100644 index 00000000..e7216726 --- /dev/null +++ b/scripts/docker/2016/install-containers-feature.ps1 @@ -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" +} diff --git a/scripts/docker/2016/install-docker.ps1 b/scripts/docker/2016/install-docker.ps1 new file mode 100644 index 00000000..89d41206 --- /dev/null +++ b/scripts/docker/2016/install-docker.ps1 @@ -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 diff --git a/scripts/docker/docker-pull-async.ps1 b/scripts/docker/docker-pull-async.ps1 index d6ecb48d..880ee589 100755 --- a/scripts/docker/docker-pull-async.ps1 +++ b/scripts/docker/docker-pull-async.ps1 @@ -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 } diff --git a/scripts/docker/enable-winrm.ps1 b/scripts/docker/enable-winrm.ps1 index 7c9dd71e..78f833e7 100644 --- a/scripts/docker/enable-winrm.ps1 +++ b/scripts/docker/enable-winrm.ps1 @@ -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 diff --git a/scripts/docker/install-containers-feature.ps1 b/scripts/docker/install-containers-feature.ps1 deleted file mode 100644 index 4f83c9de..00000000 --- a/scripts/docker/install-containers-feature.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -Write-Host "Install Containers feature" -Install-WindowsFeature -Name Containers diff --git a/windows_10_docker.json b/windows_10_docker.json index f9456473..409a1e72 100644 --- a/windows_10_docker.json +++ b/windows_10_docker.json @@ -26,7 +26,7 @@ { "type": "powershell", "scripts": [ - "./scripts/docker/install-containers-feature-windows10.ps1" + "./scripts/docker/10/install-containers-feature.ps1" ] }, { @@ -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", @@ -48,6 +47,7 @@ "type": "windows-shell", "scripts": [ "./scripts/uac-enable.bat", + "./scripts/set-winrm-automatic.bat", "./scripts/compact.bat" ] } diff --git a/windows_2016_docker.json b/windows_2016_docker.json index b43f4450..98a8586d 100644 --- a/windows_2016_docker.json +++ b/windows_2016_docker.json @@ -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" ], @@ -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" ], @@ -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" @@ -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",