无法启动虚拟机 'MobyLinuxVM',因为 Hyper-V 组件之一不是 运行

Failed to start the virtual machine 'MobyLinuxVM' because one of the Hyper-V components is not running

我在使用 Window 服务器安装 Docker 时遇到了一些问题。
环境列表:

1 Windows 10 (Physical Machine)
2.VMware® Workstation Player (12~ above) URL
3.Windows Server 2016 at the VM
4.Docker CE for Windows(stable) URL

问题图片及内容

Unable to start: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: 'MobyLinuxVM' failed to start.

Failed to start the virtual machine 'MobyLinuxVM' because one of the Hyper-V components is not running.

'MobyLinuxVM' failed to start. (Virtual machine ID BBD755F7-05B6-4933-B1E0-F8ACA3D2467B)     

The Virtual Machine Management Service failed to start the virtual machine 'MobyLinuxVM' because one of the Hyper-V components is not running (Virtual machine ID BBD755F7-05B6-4933-B1E0-F8ACA3D2467B).
at Start-MobyLinuxVM, <No file>: line 315
at <ScriptBlock>, <No file>: line 410
   at Docker.Backend.ContainerEngine.Linux.DoStart(Settings settings, String daemonOptions) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\ContainerEngine\Linux.cs:line 256
   at Docker.Backend.ContainerEngine.Linux.Start(Settings settings, String daemonOptions) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\ContainerEngine\Linux.cs:line 130
   at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass9_0.<Register>b__0(Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeServer.cs:line 47
   at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeServer.cs:line 145

我该如何解决这个问题,谢谢。

大家好我已经找到了解决这个问题的答案希望这个内容可以帮助有同样问题的人。
1.在Virtual Machine Settings设置VM(如下图)

  1. 在Windows Server 2016中设置Hyper-V(如下图)

普通话参考URL

如果这有助于其他人解决此问题,我发现 运行 来自管理员命令提示符的这些命令修复了我的 Hyper-V 问题:

net stop vmms 
net start vmms

然后我可以毫无问题地启动我的 docker 容器。

如果您在安装了 Azure Windows 10 VM 上遇到此错误, 有一个 解决方案 =39=] 这已经是 Nested Virtualization capable VM in other words your Azure VM must be V3 sized as minimum (DV3 or EV3):

  • Ensure Windows Hyper-V featutes are enabled by running PowerShell cmdlet:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -Verbose

  • Ensure Windows Containers feature is enabled by running PowerShell cmdlet:

Enable-WindowsOptionalFeature -Online -FeatureName Containers -All -Verbose

  • Ensure Hypervisor is set to auto start in the Boot Configuration Database (BCD) by running in elevated command prompt the command:

bcdedit /set hypervisorlaunchtype Auto

完成上述所有 运行 并重新启动 Azure VM 后,Docker 应该会正常启动。

In addition to the Answer above the PowerShell cmdlet to set the Virtual Machine Setting is:

Set-VMProcessor -VMName <Enter-VM-Name> -ExposeVirtualizationExtensions $true -Verbose

Still have an issue and haven't rebooted yet?! - just restart the windows services by running the following:

net stop vmms 
net start vmms
  1. 以管理员身份打开 PowerShell 或 CMD 会话。

  2. 键入以下命令:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
    

我转到 docker 设置并在 General 部分选择安装 other version(页面底部为 link)。我最初安装的是stable,改成beta/edge.

没有任何问题。

实际上是因为您没有在主机上启用 ExposeVirtualizationExtensions。
关闭嵌套的 VM。 运行 PS 主机上的命令:

Set-VMProcessor -VMName "NESTED VM NAME" -ExposeVirtualizationExtensions $true

然后再次启动嵌套 VM(其中包含 docker)。

这是一个嵌套的虚拟化问题,需要修复 运行 VMWare 6.5 和 Windows 10 个来宾关闭 VM 和 select 向来宾公开硬件辅助虚拟化的选项 OS.

启用 Hyper-V 功能在 Azure VM 中还不够。您必须启用 "Nested virtualization",因此根据 documentation 您应该选择 v3 大小的 VM:

all v3 virtual machines support nested virtualization

调整大小后,VM 将重新启动,Hyper-V 中的 DockerVM 将 运行。

VMWare

对于 VMWare,要在来宾 OS 上启用硬件虚拟化,您可以从 VMWare Web 客户端进行。请注意,传统桌面客户端没有在 Guest OS 上启用硬件虚拟化的选项。请记住先关闭来宾 OS,否则该选项将被禁用。

另见:https://github.com/docker/for-win/issues/4470#issuecomment-519511295

Windows 管理程序

如果您使用 Windows Hypervisor 而不是 VM Ware 之类的东西进行虚拟化,在这种情况下 运行 下面来自主机的命令:

Set-VMProcessor MyVM2 -ExposeVirtualizationExtensions $true

参见:https://github.com/docker/for-win/issues/4470#issuecomment-579529145