From 21024f82694a3139cb2b9a3c954420e73a7038fb Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Wed, 26 Jun 2019 17:01:50 +0200 Subject: [PATCH] improvement(windows): check for Hyper-V and ask if user wants Docker Allows installation on machines without Hyper-V option, and avoids hard requirement on Docker. --- docs/basics/installation.md | 15 ++++++++++----- support/install.ps1 | 25 +++++++++++++++++++++---- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/docs/basics/installation.md b/docs/basics/installation.md index 21c52df095..d931715cfd 100644 --- a/docs/basics/installation.md +++ b/docs/basics/installation.md @@ -49,7 +49,11 @@ To later upgrade to the newest version, simply run `brew update` and then `brew ### Windows -You can run Garden on Windows 10 Pro or Enterprise editions (the Home edition unfortunately does not work because it does not include support for virtualization). +You can run Garden on Windows 10 Home, Pro or Enterprise editions. + +_Note: The Home edition doesn't support virtualization, but you can still use Garden if you're working with +[remote clusters](../using-garden/remote-clusters.md) and +[in-cluster building](../using-garden/in-cluster-building.md)._ To install the Garden CLI and its dependencies, please use our installation script. To run the script, open PowerShell as an administrator and run: @@ -60,10 +64,11 @@ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.We The things the script will check for are the following: * The [Chocolatey](https://chocolatey.org) package manager. The script installs it automatically if necessary. -* _git_, _rsync_ and _Docker for Windows_. The script will install or upgrade those via Chocolatey. -* Whether you have Hyper-V enabled. This is required for _Docker for Windows_. If you do not already have it enabled, - the script will enable it, but you will need to restart your computer before starting Docker for Windows. -* Whether you have Kubernetes enabled in your _Docker for Windows_ installation. +* _git_ and _rsync_ . The script will install or upgrade those via Chocolatey. +* Whether you have Hyper-V available and enabled. This is required for _Docker for Windows_. If it's available, the + installer will ask if you'd like to install _Docker for Windows_. If you do not already have it enabled, + the script will enable it, but you will need to restart your computer before starting Docker. +* If applicable, whether Kubernetes is enabled in your _Docker for Windows_ installation. To later upgrade to the newest version, simply re-run the above script. diff --git a/support/install.ps1 b/support/install.ps1 index 47653069a2..91cf48e66b 100644 --- a/support/install.ps1 +++ b/support/install.ps1 @@ -14,6 +14,15 @@ # For more information visit https://docs.garden.io/ Function CheckHyperV { + $hyperv = Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online + if($hyperv) { + return $true + } else { + return $false + } +} + +Function EnableHyperV { # if ((New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -eq $false) { # ContinueYN("To check whether Hyper-V is enabled (and enable it if necessary), please run as Administrator. If you choose to continue the Hyper-V check will be skipped.") # return @@ -102,9 +111,17 @@ choco upgrade -y git rsync docker-for-windows [Console]::ResetColor() -# Check system configuration -CheckHyperV -CheckKubernetes +if (CheckHyperV) { + Write-Host "Hyper-V is available. Would you like to install Docker for Windows? (y/n)" + $response = Read-Host + if ( $response -eq "y" ) { + EnableHyperV + choco upgrade -y docker-for-windows + CheckKubernetes + } +} else { + Write-Host "Hyper-V is NOT available. Docker for Windows is not available on this machine." -ForegroundColor Yellow +} # Install the garden binary $homedir = Resolve-Path "~" @@ -177,5 +194,5 @@ You can now run the garden command in your shell (you may need to restart your s Please head over to https://docs.garden.io for more information on how to get started. Note: Please see the logs above for any warnings. If Docker for Windows was just installed and/or - Hyper-V was just enabled, you may need to restart your computer before using Docker and Garden. + Hyper-V was just enabled, you may need to restart your computer before using Docker. ")