在 Windows 上安装后无法启动 docker

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36885985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:34:59  来源:igfitidea点击:

Cannot start docker after installation on Windows

windowsdockervirtual-machine

提问by Denis Starkov

I am a new to Docker. After the installation of Docker Toolbox (OS: Windows 10) I run Docker Quickstart Terminal and in the console I see this:

我是 Docker 的新手。安装 Docker 工具箱(操作系统:Windows 10)后,我运行 Docker Quickstart Terminal 并在控制台中看到:

Running pre-create checks...
Error wirh pre-create check: "Hyper-V is installed. VirtualBox won't boot a 64bits VM when Hyper-V is activated. It it's installed but deactivated, you can use --virtualbox-no-vtx-check to try anyways"
Look like something went wrong in step 'Checking if machine default exists'...
Press any key to continue...

What did I do wrong? All checking of system and install steps are taken from here.

我做错了什么?所有的系统检查和安装步骤都从这里开始

Thank you very much for your help!

非常感谢您的帮助!

采纳答案by Gene

I got the same error when I installed Docker Toolbox on my Windows 10 machine.

我在 Windows 10 机器上安装 Docker Toolbox 时遇到了同样的错误。

Solution:

解决方案:

  1. Install Docker Community Edition(not Docker Toolbox)
  2. Enable Hyper-V
  1. 安装Docker 社区版(不是 Docker 工具箱)
  2. 启用 Hyper-V

Open Control Panel -> System and Security -> Programs (left panel) -> Turn Windows features on or off -> Check the Hyper-V box

打开控制面板 -> 系统和安全 -> 程序(左面板) -> 打开或关闭 Windows 功能 -> 选中 Hyper-V 框

As of 2017's Win 10, if you don't have Hyper-V option, then your Windows OS is not Enterprise Edition. Also, Docker seems to work a lot better on Intel processors (not AMD).

从 2017 年的 Win 10 开始,如果您没有 Hyper-V 选项,那么您的 Windows 操作系统就不是企业版。此外,Docker 在 Intel 处理器(不是 AMD)上似乎运行得更好。

  1. Add C:\Program Files\Docker\Docker\resources\bin to Path in Environmental Variables.
  2. Open Git Bash and type docker-compose upand now that command should work.
  1. 将 C:\Program Files\Docker\Docker\resources\bin 添加到环境变量的路径中。
  2. 打开 Git Bash 并输入docker-compose up,现在该命令应该可以工作了。

If you don't have GitBash, please download it.

如果您没有 GitBash,请下载它。

回答by ArgonQQ

Hyper-V and VirtualBox are conflicting each other.

Hyper-V 和 VirtualBox 相互冲突。

You can either uninstall Hyper-V or run

您可以卸载 Hyper-V 或运行

docker-machine create -d virtualbox --virtualbox-no-vtx-check test

Source

来源

回答by curiousgeek

Docker supports Hyper-V as the driver

Docker 支持 Hyper-V 作为驱动程序

You need to perform the following steps:

您需要执行以下步骤:

  • Create a virtual switch, refer to this articleon how to do that

  • Create a docker machine using that network switch and hyper-V driver.

    docker-machine create -d hyperv --hyperv-virtual-switch "name of the virtual switch created above" default
    
  • 创建一个虚拟交换机,请参阅这篇文章了解如何做到这一点

  • 使用该网络交换机和 hyper-V 驱动程序创建一个 docker 机器。

    docker-machine create -d hyperv --hyperv-virtual-switch "name of the virtual switch created above" default
    

回答by cph2117

I was having the same issue, and thisblog post solved it. The author runs you through the steps of adding the --virtualbox-no-vtx-checkflag to the docker shell script.

我遇到了同样的问题,这篇博文解决了它。作者带你完成--virtualbox-no-vtx-check在docker shell脚本中添加flag的步骤。

Virtualbox and Hyper-V don't play well together. I am NOT the author.

Virtualbox 和 Hyper-V 不能很好地协同工作。我不是作者。

回答by ScarletAndGray

I set the Hyper-V off using windows feature on off and it worked for me.

我使用关闭的 Windows 功能将 Hyper-V 设置为关闭,它对我有用。

回答by shiraz lavi

See if when you run:

查看运行时是否:

docker-machine create -d hyperv --hyperv-virtual-switch "Virtual Switch" default

docker-machine create -d hyperv --hyperv-virtual-switch "Virtual Switch" default

you get Error with: pre-create check: "Hyper-V PowerShell Module is not available"

你得到 Error with: pre-create check: "Hyper-V PowerShell Module is not available"

If so just enable in Docker(icon on your desktop)->settings->expose daemon on TCP ...

如果是这样,只需在 Docker 中启用(桌面上的图标)->设置->在 TCP 上公开守护进程...

回答by Muhammad Ali Ahsan

I pressed the Windows Button on keyboard. Typed 'Hyper-V Manager'. It opened the 'Hyper-V Manager'. Then I right clicked on my machine name. There was an option to 'stop'. I selected this option. It stopped the 'Hyper-V' on my machine and then Kitematic worked fine, i.e., it download the hello-world-nginx and displayed the web page.

我按下了键盘上的 Windows 按钮。键入“Hyper-V 管理器”。它打开了“Hyper-V 管理器”。然后我右键单击我的机器名称。有一个选项可以“停止”。我选择了这个选项。它停止了我机器上的“Hyper-V”,然后 Kitematic 工作正常,即它下载 hello-world-nginx 并显示网页。

NOTE: This is strange and I am not sure why. Once I have done above steps, now when I restarted the Hyper-V using Hyper-V Manager, Kitematic is still working and downloading images. Can anybody comment why it is now still working when Hyper-V is also running ? Thank you.

注意:这很奇怪,我不知道为什么。完成上述步骤后,现在当我使用 Hyper-V 管理器重新启动 Hyper-V 时,Kitematic 仍在工作并下载图像。任何人都可以评论为什么当 Hyper-V 也在运行时它现在仍然可以工作?谢谢你。

Good Ali Ahsan

好阿里阿山

回答by Ithar

The solution as suggested by @Gene is correct and works perfectly if:

@Gene 建议的解决方案是正确的,并且在以下情况下可以完美运行:

  1. One has windows pro edition
  2. Both Hyper-V Management Tools and Hyper-V Platform are enabled
  1. 一个有 Windows 专业版
  2. Hyper-V 管理工具和 Hyper-V 平台均已启用

Sometime this isn't always the case; here is what to do:

有时情况并非总是如此。这是该怎么做:

Check Windows Edition:

检查 Windows 版本:

To check which version right click on Windows key and select System. Scroll down to Windows specifications and look at [Edition]

要检查哪个版本,请右键单击 Windows 键并选择系统。向下滚动到 Windows 规范并查看 [Edition]

Check Hyper-V Platform (virtualisation)

检查 Hyper-V 平台(虚拟化)

For Hyper-V Platform to be enabled one must turn on virtualisation; normally this is done via the BIOS.

要启用 Hyper-V 平台,必须开启虚拟化;通常这是通过 BIOS 完成的。

On HP laptop one this is done from the BIOS.

在 HP 笔记本电脑上,这是通过 BIOS 完成的。

  • On start-up click Ctrl+F10
  • Press the right arrow key to System Configuration tab.
  • Select Virtualization Technology and then press the Enter key.
  • Select Enabled and press the Enter key.
  • 启动时点击Ctrl+F10
  • 按向右箭头键进入系统配置选项卡。
  • 选择虚拟化技术,然后按 Enter 键。
  • 选择已启用并按 Enter 键。

Once these steps are done then:

完成这些步骤后:

  1. Search for Turn Windows features on or off.
  2. Scroll down to Hyper-V
  3. Tick this box (Ensure you see a tick NOT a black box which indicates some features not enabled)
  1. 搜索打开或关闭 Windows 功能。
  2. 向下滚动到 Hyper-V
  3. 勾选此框(确保您看到一个勾号,而不是表示某些功能未启用的黑框)

Upon restart docker should be running... good luck !!

重新启动后,docker 应该正在运行……祝你好运!!

回答by Suresh V

You need to disable Hypervisor to check new application that use VT-x before the virtual machine launch:

您需要在虚拟机启动之前禁用 Hypervisor 以检查使用 VT-x 的新应用程序:

  1. Open the command prompt as Administrator

  2. Run bcdeditto check hypervisor status:

  3. Check hypervisor launch type.

  4. If is set to auto then disable it:

    bcdedit /set hypervisorlaunchtype off 
    
  5. Reboot host machine and launch VirtualBox again

  1. 以管理员身份打开命令提示符

  2. 运行bcdedit以检查管理程序状态:

  3. 检查管理程序启动类型。

  4. 如果设置为自动然后禁用它:

    bcdedit /set hypervisorlaunchtype off 
    
  5. 重新启动主机并再次启动 VirtualBox

After performing above steps I opened again Docker Quickstart terminal and it is working fine.

执行上述步骤后,我再次打开 Docker Quickstart 终端,它工作正常。