Skip to content

Instantly share code, notes, and snippets.

@developerprofiles
Created March 25, 2020 14:33
Show Gist options
  • Save developerprofiles/2ab96f3830e7e74c375018c336cc8306 to your computer and use it in GitHub Desktop.
Save developerprofiles/2ab96f3830e7e74c375018c336cc8306 to your computer and use it in GitHub Desktop.
#Docker for Windows requires Hyper-V. This needs to be disabled before you can run VirtualBox.
#And to start using Docker for Windows again, re-enable Hyper-V:
# Run from elevated prompt (admin privileges)
function SwitchDockerorVirtualBox{
[CmdletBinding()]
param(
[switch]$Docker
)
if ($Docker)
{
# Docker for Windows requires Hyper-V
# Run from elevated prompt with (admin privileges)
bcdedit /set hypervisorlaunchtype auto
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
# DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online
}
else
{
# For VirtualBox needs to disable Hyper-V:
# Run from elevated prompt (admin privileges)
bcdedit /set hypervisorlaunchtype off
}
}
SwitchDockerorVirtualBox -Docker:$true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment