Win10 Pro 关闭hyper-v虚拟化重新启用后无法启动Docker

Hyper-V会和VirtualBox产生冲突,hyper-v和VirtualBox等只能开启一个。

前段时间因在本机使用VirtualBox搭建k8s集群,关闭了hyper-v,现在需要使用Docker for Desktop,发现启用hyper-v后,依然无法启动docker。提示如下:

Hardware assisted virtualization and data execution protection must be enabled in the BIOS

1、禁用hyper-v
按win+x 以管理员身份运行Windows PowerShell(管理员):

img

输入如下命令:

bcdedit /set hypervisorlaunchtype off

2、启用hyper-v
按win+x 以管理员身份运行Windows PowerShell(管理员):,输入如下命令:
bcdedit /set hypervisorlaunchtype auto

执行完启用命令后,启动docker依然报错误:Hardware assisted virtualization and data execution protection must be enabled in the BIOS

应该是执行启用命令时,并没有把hyper-v的全部组件启动,因此还需要执行如下开启hyper-v组件的命令:

按win+x 以管理员身份运行Windows PowerShell(管理员):
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

执行完成后,重启电脑,docker即可正常启动。