Adjust Docker installation for Win10 and Win2016

parent e88b13e8
#!/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
#!/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
# 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
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
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"
}
$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
......@@ -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
}
......
......@@ -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
......
Write-Host "Install Containers feature"
Install-WindowsFeature -Name Containers
......@@ -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"
]
}
......
......@@ -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",
......
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