dockerdocker-composedockerfiledocker-machine

how to enable virtualization capabilities when running docker in macbook pro


I want to run docker in my macbook pro.but an error come to my eyes. enter image description here

Firstly,I think my cpu don't have the virtualization capabilities.but when I run "sysctl -a | grep machdep.cpu.features",I found i was wrong enter image description here

my cpu have the VMX.So,Could someone tell me how to enable virtualization capabilities in my computer to run docker. what's more,my laptop is mackbook7.1(13 inch,2010 Middle) Expecting your answers.


Solution

  • The official documentation is here: What to know before you install.

    This 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)

    I've done some research on the MMU and EPT part. From https://en.wikipedia.org/wiki/X86_virtualization31 I found out that EPT is part of VT-x. MMU is part of VT-d.
    In short, that means the CPU should support both VT-x and VT-d.

    Since the requirement described "Mac must be a 2010 or newer model..." I made the assumption I was safe. Either way, I was able to look up more information about the CPU in my iMac. Using the sysctl command gives you information about the model number of the CPU, in my case an Intel Core i5-760 Processor.

    $ 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.

    Note: if EPT, VT-d and VT-x are supported, check your BIOS to enable them.

    XHyve needs the Hypervisor framework:

    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.