[英]Unable to start Docker in Windows 10 - Hyper-V error is thrown
I get the below error while starting of docker in Windows 10. Anyone can guide me to install docker correctly?在 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 'XXXX' because the object was not
found. The object might have been deleted, or you might not have permission to
perform the task. Verify that the Virtual Machine Management service on the
computer is running. If the service is running, try to perform the task again by
using Run as Administrator.
at New-MobyLinuxVM, <No file>: line 242
at <ScriptBlock>, <No file>: line 362
at Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters)
at Docker.Backend.ContainerEngine.Linux.Start(Settings settings)
at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.<Register>b__0(Object[] parameters)
at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)
Versions版本
OS : Windows 10 Enterprise
Version : 1607
OS Build : 14393.576
Docker Version : 1.12.3 (Stable)
Run “MOFCOMP %SYSTEMROOT%\\System32\\WindowsVirtualization.V2.mof”
from command prompt in admin mode.在管理员模式下从命令提示符运行
“MOFCOMP %SYSTEMROOT%\\System32\\WindowsVirtualization.V2.mof”
。 No need to restart machine as well after this execution, it worked for me.执行此操作后也无需重新启动机器,它对我有用。
I have also faced this same issue.我也遇到过同样的问题。 I have solved it by removing all MobyLinuxVM virtual machines.
我已经通过删除所有 MobyLinuxVM 虚拟机解决了这个问题。 Following are its steps.
以下是它的步骤。
These steps has solved this issue on my system.这些步骤在我的系统上解决了这个问题。
Assuming you are trying to run a Windows container:假设您正在尝试运行 Windows 容器:
Right click on the Docker system tray icon, then select “Switch to Windows Containers”.右键单击 Docker 系统托盘图标,然后选择“切换到 Windows 容器”。
It will eventually have you reboot the system, but will no longer attempt to run the MobyLinuxVm as mentioned in your error message.它最终会让您重新启动系统,但不会再尝试运行错误消息中提到的 MobyLinuxVm。
If it helps anyone, I am on Apple hardware (MacOS) running a Windows 10 VM via Parallels.如果它对任何人有帮助,我将使用通过 Parallels 运行 Windows 10 VM 的 Apple 硬件 (MacOS)。 I also made sure that under my parallel settings > Processors and Memory > Advanced, I had Hypervision applications enabled.
我还确保在我的并行设置 > 处理器和内存 > 高级下,我启用了 Hypervision 应用程序。
This issue is very similar to this the another question Docker - The computer 'WINDOWS10-ON-SE' could not be resolved这个问题与Docker的另一个问题非常相似- The computer 'WINDOWS10-ON-SE' could not beresolution
See my answer at https://stackoverflow.com/a/45099242/279272请参阅我在https://stackoverflow.com/a/45099242/279272 上的回答
I was also facing the same issue but it was random in nature, I found it is due to some inaccessibility of network card by the docker start script.我也面临同样的问题,但它本质上是随机的,我发现这是由于 docker start 脚本无法访问网卡。 This inaccessibility further blocks the start up process of docker.
这种不可访问性进一步阻止了 docker 的启动过程。
I found one hack and it is working fine on my windows machine我发现了一个 hack,它在我的 Windows 机器上运行良好
Open C:\\Program Files\\Docker\\Docker\\resources\\mobylinux.ps1
with any editor in admin mode.在管理模式下使用任何编辑器打开
C:\\Program Files\\Docker\\Docker\\resources\\mobylinux.ps1
。 Find following code (around line 164)找到以下代码(大约第 164 行)
$networkAdapter | Remove-NetIPAddress -Confirm:$false -ea SilentlyContinue
$networkAdapter | Set-NetIPInterface -Dhcp Disabled -ea SilentlyContinue
$networkAdapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress $switchAddress -PrefixLength ($SwitchSubnetMaskSize) -ea Stop | Out-Null
Add a return
after line 165 in a new line like below and save the file.在如下所示的新行中在第 165 行之后添加一个
return
并保存文件。
$networkAdapter | Remove-NetIPAddress -Confirm:$false -ea SilentlyContinue
$networkAdapter | Set-NetIPInterface -Dhcp Disabled -ea SilentlyContinue
return
$networkAdapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress $switchAddress -PrefixLength ($SwitchSubnetMaskSize) -ea Stop | Out-Null
Now restart docker and after restart completion execute following commands in dos admin mode to setup the network card manually现在重启docker,重启完成后在dos admin模式下执行以下命令手动设置网卡
netsh interface ipv4 set address name="vEthernet (DockerNAT)" static 10.0.75.1 255.255.255.0
You have to run this command everytime whenever you are doing system restart and docker completes start process (due to any reason).每当您进行系统重启并且 docker 完成启动过程(由于任何原因)时,您都必须运行此命令。 TIP : create a batch file of this command and save somewhere handy.
提示:创建此命令的批处理文件并保存在方便的地方。
Note: The ps hack would get undone by any docker update.注意:任何 docker 更新都会撤销 ps hack。 so be aware...
所以要注意...
to install docker, BIOS-level Hardware Virtualization support is required.要安装 docker,需要 BIOS 级别的硬件虚拟化支持。 so you can do the following..
所以你可以做以下..
-Ensure that hardware virtualization support is turned on in the BIOS settings in your mother board settings when you start your computer, under (system security => virtualization technology VTX => enable it) then Save the BIOS settings and boot up the machine normally. - 确保在启动计算机时在主板设置中的 BIOS 设置中打开硬件虚拟化支持,在(系统安全 => 虚拟化技术 VTX => 启用它)下,然后保存 BIOS 设置并正常启动机器。 then enable hyper v if it was not enabled by running this command in your powershell as an admin:
然后通过在您的 powershell 中以管理员身份运行此命令来启用 hyper v(如果它未启用):
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
对我来说,将 Windows 10 专业版更新到 1809 版解决了这个问题
On windows 10, I fixed the issue by executing the steps below:在 Windows 10 上,我通过执行以下步骤解决了该问题:
French Windows version:法语 Windows 版本:
English Windows version:英文视窗版本:
Hope this will help someone else.希望这会帮助别人。
当您启动 Windows 并启动 docker 时,只需右键单击右下栏中的 docker 并切换到 Windows 容器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.