简体   繁体   English

如何在 Windows 10 上运行 docker?

[英]How to run docker on windows 10?

I just installed Docker on Windows 10. When I run Docker as an administrator I get the following error:我刚刚在 Windows 10 上安装了 Docker。当我以管理员身份运行 Docker 时,出现以下错误:

Unable to create: The running command stopped because the preference 
variable "ErrorActionPreference" or common parameter is set to Stop: Hyper-V 
encountered an error trying to access an object on computer 'WP2975' because 
the object was not found. The object might have been deleted. Verify that 
the Virtual Machine Management service on the computer is running.
at New-Switch, <No file>: line 121
at <ScriptBlock>, <No file>: line 411
at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters) 
in C:\workspaces\stable 18.09.x\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeClient.cs:line 36
at Docker.Actions.DoStart(SynchronizationContext syncCtx, Boolean 
showWelcomeWindow, Boolean executeAfterStartCleanup) in 
C:\workspaces\stable- 
18.09.x\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 92
at Docker.Actions.<>c__DisplayClass19_0.<Start>b__0() in 
C:\workspaces\stable- 
18.09.x\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 74
at Docker.WPF.TaskQueue.<>c__DisplayClass19_0.<.ctor>b__1() in 
C:\workspaces\stable- 
18.09.x\src\github.com\docker\pinata\win\src\Docker.WPF\TaskQueue.cs:line 59

I checked if Hyper-V is running on the computer.我检查了 Hyper-V 是否在计算机上运行。

I also did the following in powershell:我还在powershell中执行了以下操作:

Ensure Windows Hyper-V featutes are enabled by running PowerShell cmdlet:通过运行 PowerShell cmdlet 确保启用 Windows Hyper-V 功能:

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

Ensure Windows Containers feature is enabled by running PowerShell cmdlet:通过运行 PowerShell cmdlet 确保 Windows 容器功能已启用:

 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:通过在提升的命令提示符下运行以下命令,确保虚拟机管理程序在引导配置数据库 (BCD) 中设置为自动启动:

 bcdedit /set hypervisorlaunchtype Auto

( Found it on: Failed to start the virtual machine 'MobyLinuxVM' because one of the Hyper-V components is not running ) (在: 无法启动虚拟机“MobyLinuxVM”,因为其中一个 Hyper-V 组件未运行

But nothing helps.但没有任何帮助。

I also reinstalled docker two times.我也重新安装了两次docker。

Please do make sure that the following three windows services are in running state请确保以下三个windows服务处于运行状态

HV Host Service
Hyper-V Host Compute Service
Hyper-V Virtual Machine Management

If Windows 10 you're referring to has an ancient edition (lower then anniversary, ie 1607) there is no chance in hell you can get it working.如果您所指的 Windows 10 有一个古老的版本(低于周年纪念,即 1607),那么您根本不可能让它工作。 To check version of your OS run 'winver'.要检查您的操作系统版本,请运行“winver”。 The problem with these editions is that they don't support nested virtualization Docker require.这些版本的问题在于它们不支持 Docker 要求的嵌套虚拟化。

Now, it's not clear WHERE are you running your VM.现在,不清楚你在哪里运行你的虚拟机。 If it's VMWare on your PC it should be relatively easy to fix, but if it's Cloud, can be a different story.如果它是您 PC 上的 VMWare,它应该相对容易修复,但如果它是云,则可能是另一回事。 The thing is that in Azure, for instance, not all VMs support nested virtualization, so if you hastened to provision a VM, it might be a problem.例如,在 Azure 中,并非所有 VM 都支持嵌套虚拟化,因此如果您急于配置 VM,则可能会出现问题。 If you want to get it right, use v3 VM types and up ( refer this article for more info ).如果您想正确使用,请使用 v3 VM 类型及更高版本( 有关详细信息,请参阅本文)。

In my case 'HV Host Service' didn't work as well, but fortunately I was able to resize a VM to a proper tier (v3) and voila!就我而言,“HV 主机服务”效果不佳,但幸运的是,我能够将 VM 调整为适当的层级 (v3),瞧! Docker started right away. Docker 立即启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM