Mac OSX VM, Docker For Mac??


Recommended Posts

Hi All.

 

I have successful followed @SpaceInvaderOne's videos, and built my self a kvm mac os machine.

Now that i have the mac running is their any way to get docker for mac running?

I would like to be able to develop websites, and other programs using a local docker installation. But when i try to install Docker for Mac, an error comes up saying that CPU virtualization and Hyper Visor support is needed. After trying every search term and combination of them, i find that this line might the the cause:

<qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,+invtsc,vmware-cpuid-freq=on,'/>

In this video, @SpaceInvaderOne mentions that the Penryn cpu does not support vt-x. now that the video is 1.5 years old, is their any way to change the cpu and still have osx work?

 

Am I even looking in the right direction?

Link to comment

Hi @dashtripledot   yes you "should" be able to do this using penryn bu adding the needed features?

 

first, you will have to make sure nested virtualisation is enabled on the Unraid server.

I believe it is enabled in the latest Unraid by default. Older versions I am not sure

You can check by running

for AMD cpus

cat /sys/module/kvm_amd/parameters/nested

for intel

cat /sys/module/kvm_amd/parameters/nested

 

If you get a zero its disabled and if you get a 1 then its enabled

 

If you get a zero then you can enable by unloading the module (also make sure all vms shutdown first)

amd

modprobe -r kvm_amd

or intel

modprobe -r kvm_intel

then running

amd

modprobe kvm_amd nested=1

or intel

modprobe kvm_intel nested=1

------------------------------------------

 

Then you will have to pass through these CPU features to the XML line that you quoted -  vmx and rdtscp

 

so that line would look like 

 

<qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,vmx,rdtscp,+invtsc,vmware-cpuid-freq=on,'/>

You can add any features to the cpu that the host has in this line to improve the cpu in the MacOS guest.

This will improve the performance

<qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,vmx,rdtscp,+invtsc,+avx,+avx2,+aes,+xsave,+xsaveopt,+ssse3,+sse4_2,+popcnt,vmware-cpuid-freq=on,'/>

 So either of the 2 above should make docker work in the MacOS vm.

I

  • Upvote 2
Link to comment

thanks for the reply.

 

after using the following line:

<qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,vmx,rdtscp,+invtsc,+avx,+avx2,+aes,+xsave,+xsaveopt,+ssse3,+sse4_2,+popcnt,vmware-cpuid-freq=on,'/>

"sysctl kern.hv_support" still returns 0. for docker to work it should return 1. (following this page)

could this be a clover config problem?

 

I am running an amd fx 8350, if that helps.

Is there a list of the cpu features that can be passes through?

Link to comment

Um did a bit of testing tonight. Not good news for us AMD guys.

Forgot that AMD virtualisation is svm not vmx.

So svm would need to be passed on amd cpus for that to work

However, running 

sysctl machdep.cpu.features

on osx it doesnt show svm as present. Strange as if i do the same on a debian vm then run  

cat /proc/cpuinfo

I can see svm passed even through I am running that vm also with emulated penryn same as my osx vm

 

Thing is I dont think that docker will ever work on a vm hackintosh using an AMD cpu. 

I think it will always look for vmx (not svm) because apple never thinks an AMD cpu and thus SVM will be present. So it will fail and not load complaining about the cpu.

 

I dont have any intel hardware here to test with to see if docker would work on an intel based vm hackintosh with vmx & rdtscp passed. I think it should.

 

Maybe @1812 , please if you have time could you on your intel vm hack try using

<qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,vmx,rdtscp,+invtsc,vmware-cpuid-freq=on,'/>

then run 

sysctl machdep.cpu.features

and see if vmx is listed. Then if so check

sysctl kern.hv_support

and see if you get a 1. If so does docker work on osx?

Link to comment
23 hours ago, SpaceInvaderOne said:

Maybe @1812 , please if you have time could you on your intel vm hack try using


<qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,vmx,rdtscp,+invtsc,vmware-cpuid-freq=on,'/>

then run 


sysctl machdep.cpu.features

and see if vmx is listed. Then if so check


sysctl kern.hv_support

and see if you get a 1. If so does docker work on osx?

 

using Intel® Xeon® CPU E5-1660 v2 @ 3.70GHz

 

    <qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,vmx,rdtscp,+invtsc,+avx,+aes,+xsave,xsaveopt,vmware-cpuid-freq=on,'/>

 

for sysctl machdep.cpu.features shows

 

sysctl machdep.cpu.features
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 SSE3 SSSE3 CX16 SSE4.1 x2APIC AES VMM XSAVE OSXSAVE AVX1.0

 

no vmx, but still ran the second command, sysctl kern.hv_support

 

kern.hv_support: 0

 

 

I did not test to see if docker would run regardless, I may look into it, but it will be next week, (work is super busy for the next 5 days.)

 

 

Link to comment
  • 1 year later...
  • 4 months later...

 

I followed the MacInABox video and created my Mojave VM that way. However, I have the same problem as the OP with not being able to get Docker to run in the VM. I tried enabling Virtualization (from this post)  in UnRaid using the boot config parameter kvm-intel.nested=1 and adding this to the VM's xml file under <cpu>  <feature policy='require' name='vmx'/> but couldn't get it to work. 

 

My Settings:

UNRAID:  6.8.3

CPU: Intel® Xeon® CPU E5-2630 v2 @2.60GHz

 

UNRAID kvm_intel setting

# cat /sys/module/kvm_intel/parameters/nested
Y

 

UNRAID Syslinux configuration:

kernel /bzimage
append vfio-pci.ids=1b73:1100 kvm-intel.nested=1 initrd=/bzroot

MojaveVM XML setting:

  <cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>qemu64</model>
    <feature policy='require' name='vmx'/>
  </cpu>


<qemu:arg value='Penryn,vendor=GenuineIntel,kvm=on,vmx,rdtscp,+invtsc,+avx,+avx2,+aes,+xsave,+xsaveopt,+ssse3,+sse4_2,+popcnt,vmware-cpuid-freq=on,'/>

 

Mojave VM:

(note that VMX is enabled but hv_support is still 0)

$ sysctl machdep.cpu.features

machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 SSE3 VMX SSSE3 CX16 SSE4.1 SSE4.2 x2APIC POPCNT AES VMM XSAVE OSXSAVE AVX1.0 

$ sysctl kern.hv_support 

kern.hv_support: 0

I don't know what else to do. I thought this should work since my host is an Intel CPU.

Edited by frakman1
Link to comment

It shouldn't work with custom arg Penryn. You need to passthrough your Intel cpu.

Here and some posts below some more info, also explaining why Penryn doesn't work (ps: amd is not working with nested virtualization):

Btw, in syslinux it's kvm_intel.nested=1 not kvm-intel.nested=1

Edited by ghost82
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.