docker - 如何在 macbook pro 中运行 docker 时启用虚拟化功能

标签 docker docker-compose dockerfile docker-machine

我想在我的 macbook pro 中运行 docker。但是我看到了一个错误。 enter image description here

首先,我认为我的 cpu 没有虚拟化功能。但是当我运行“sysctl -a | grep machdep.cpu.features”时,我发现我错了 enter image description here

我的 cpu 有 VMX。所以,有人能告诉我如何在我的计算机中启用虚拟化功能以运行 docker。 另外,我的笔记本电脑是mackbook7.1(13寸,2010年中) 期待您的回答。

最佳答案

官方文档在这里:What to know before you install .

thread mentions :

The Getting Started document describes the following prerequisites:

  • Mac must be a 2010 or newer model, with Intel’s hardware support for memory management unit (MMU) virtualization; i.e., Extended Page Tables (EPT)

我对 MMU 和 EPT 部分做了一些研究。来自 https://en.wikipedia.org/wiki/X86_virtualization31我发现 EPT 是 VT-x 的一部分。 MMU是VT-d的一部分。
简而言之,这意味着 CPU 应该同时支持 VT-x 和 VT-d。

由于要求描述为“Mac 必须是 2010 或更新型号...”,我假设我是安全的。无论哪种方式,我都能够在我的 iMac 中查找有关 CPU 的更多信息。使用 sysctl 命令可为您提供有关 CPU 型号的信息,在我的例子中是 Intel Core i5-760 处理器。

$ sysctl -n machdep.cpu.brand_string
Intel(R) Core(TM) i5 CPU         760  @ 2.80GHz

This model information can be used on the Intel Ark website to look up specific details of the processor. For example: http://ark.intel.com/products/48496/Intel-Core-i5-760-Processor-8M-Cache-2_80-GHz199. If you've got another CPU, go to ark.intel.com and use the search box to enter your model.

On the details page, I noticed under the "Advanced Technologies" part my CPU does support VT-x but doesn't support VT-d.

https://cdn-enterprise.discourse.org/docker/uploads/default/original/2X/e/e42e0a73c3092d05490e3cbbf975b41ecced3979.png

So that would be explaining why Docker for Mac won't run on my iMac.

注意:如果支持 EPT、VT-d 和 VT-x,请检查您的 BIOS 以启用它们。

XHyve 需要 Hypervisor 框架:

On OS X, the way of knowing if your CPU complies with all the Hypervisor.framework requirements is by checking the value of the sysctl kern.hv_support key.

$ sysctl kern.hv_support
kern.hv_support: 1
  • If it is 1, then your CPU is supported.
  • If it is 0, it means the Hypervisor.framework cannot be used with your CPU, for a reason or another.

关于docker - 如何在 macbook pro 中运行 docker 时启用虚拟化功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46751761/

相关文章:

python - 无法访问使用 docker 和 google cloud 部署的应用程序

mysql - 使用Docker创建 "restorable"MySQL数据库进行UI测试

Docker 拒绝连接

postgresql - 为什么我无法在容器中运行 pdo_pgsql?

kubernetes - openshift pod 失败并频繁重启

linux - 启动应用程序退出后如何继续使用docker容器?

docker - 无法将文件从 Docker 容器复制到主机

tomcat - 如何在aws中激活/钝化docker容器

docker-compose:在 Jenkins 上找不到命令

带有 Go cli 项目的 Docker