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/

相关文章:

docker 容器中的 Python

ruby-on-rails - 找不到Docker库/库?

docker - 使用 docker 获得 websphere 自由有什么好处?

docker - 拉取源代码并在 docker 镜像中使用它的最佳实践

php - PHP脚本无法从卷中看到目录

node.js - 如何处理 Dockerfile for dev/prod 的差异

python - 如何使用 gliderlabs/alpine :3. 3 在 Dockerfile 中设置时区

python - 文件作为Docker Python应用程序的命令行参数

wordpress - Docker用户权限说明

Dockerfile:在另一个 ENV 中引用先前定义的 ENV