简体   繁体   English

无法在 Windows 10 专业版上启动 docker?

[英]Cannot start docker on windows 10 pro?

Problem:问题:

When I try to start docker desktop it leaves me this error.当我尝试启动 docker desktop 时,它给我留下了这个错误。

Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Hyper-V was unable to find a virtual switch with name "DockerNAT".

This is the output when I issue docker version command on the terminal.这是我在终端上发出 docker version 命令时的输出。

Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:31 2019
 OS/Arch:           windows/amd64
 Experimental:      false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running. 

This working without giving any error when in windows containers.这在 Windows 容器中工作时不会出现任何错误。 But when I change it to Linux containers this happens.但是当我将其更改为 Linux 容器时,就会发生这种情况。 I tried a lot to find a solution to this problem.我尝试了很多来找到解决这个问题的方法。 But I was unable to find a solution.但我无法找到解决方案。 Can someone help me to solve this problem?有人可以帮我解决这个问题吗? Thank you.谢谢你。

You may want to check from HyperV console to ensure there is a vnet called DockerNAT.您可能需要从 HyperV 控制台检查以确保有一个名为 DockerNAT 的 vnet。

在此处输入图片说明

tray icon to see if there is some log related to why the vnet cannot be created托盘图标,查看是否有一些与为什么无法创建 vnet 相关的日志

在此处输入图片说明

Here is what works for me - open Hyper-V manager and from 'Actions' panel on the right click 'Stop Service' and confirm prompt.这是对我有用的方法 - 打开 Hyper-V 管理器,然后从右侧的“操作”面板中单击“停止服务”并确认提示。 Then, Install Docker desktop which will restart your hyper-v and create DockerNat.然后,安装 Docker 桌面,这将重新启动您的 hyper-v 并创建 DockerNat。 To check click 'Virtual Switch Manager' from 'Actions' panel and you should see it on the Left.要检查单击“操作”面板中的“虚拟开关管理器”,您应该会在左侧看到它。

Here is what worked for me:这是对我有用的:

  • Turn off the Hyper-V setting in Control Panel->Programs and Features ->"Turn Windows features on or off"在控制面板->程序和功能->“打开或关闭Windows功能”中关闭Hyper-V设置
  • Restart computer重启电脑
  • After computer has been restarted, your existing docker instance will detect that your Hyper-V setting is turned off and will ask you if you want to allow docker to enable the Hyper-V feature计算机重新启动后,您现有的 docker 实例将检测到您的 Hyper-V 设置已关闭,并会询问您是否要允许 docker 启用 Hyper-V 功能
  • Click "Yes" to allow docker to enable the Hyper-V feature on your machine单击“是”以允许 docker 在您的机器上启用 Hyper-V 功能
  • From there allow docker to start and do its thing从那里允许 docker 开始并做它的事情

After doing these steps the error went away and docker was working again完成这些步骤后,错误消失了,docker 又开始工作了

Hope this solves your issue.希望这能解决您的问题。 Enjoy!享受!

I just ran into this issue today my fix was.我今天刚遇到这个问题,我的解决方法是。

  1. bcdedit /set hypervisorlaunchtype auto bcdedit /set hypervisorlaunchtype auto
  2. Windows features > Hyper-V off Windows 功能 > Hyper-V 关闭
  3. Windows features > Windows hypervisor platform off Windows 功能 > Windows 管理程序平台关闭
  4. Windows features > Virtual machine platform on Windows 功能 > 虚拟机平台
  5. Windows features > Windows Subsystem for Linux on Windows 功能 > 适用于 Linux 的 Windows 子系统
  6. Reboot重启
  7. CMD as admin > netsh winsock reset CMD 作为管理员 > netsh winsock 重置
  8. Reboot重启
  9. Docker Desktop finally connected and everything worked Docker 桌面终于连接上了,一切正常

Running the MOFCOMP command and a reboot fixed this problem for me.运行 MOFCOMP 命令并重新启动为我解决了这个问题。

Running this command: (Command Prompt as administrator)运行此命令:(以管理员身份运行命令提示符)

MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof

Then restart然后重启

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

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