Unable to run Docker inside Docker-OSX #246

Open
opened 2025-12-29 00:21:35 +01:00 by adam · 6 comments
Owner

Originally created by @rationalthinker1 on GitHub (Sep 21, 2021).

Hello,
I want to install Docker to get it test some build process. However, I get this error. Docker requires a processor with virtualization capabilities and hypervisor support.
image

Originally created by @rationalthinker1 on GitHub (Sep 21, 2021). Hello, I want to install Docker to get it test some build process. However, I get this error. Docker requires a processor with virtualization capabilities and hypervisor support. ![image](https://user-images.githubusercontent.com/1825003/134207421-6d1899f5-61e2-4500-a9ec-e6dc5fa5bbf1.png)
Author
Owner

@rationalthinker1 commented on GitHub (Sep 22, 2021):

I used to do it before in vmware. Linux -> windows 10 -> Linux

@rationalthinker1 commented on GitHub (Sep 22, 2021): I used to do it before in vmware. Linux -> windows 10 -> Linux
Author
Owner

@sickcodes commented on GitHub (Sep 23, 2021):

@rationalthinker1

Via: https://github.com/kholia/OSX-KVM/blob/master/notes.md

Use the sysctl kern.hv_support (output 1 is good) command to check if Hypervisor is enabled within the macOS VM.

If Hypervisor is not enabled, check that you have the required CPU features. Run the sysctl -a | grep machdep.cpu.features command and look for the presence of VMX flag.

@sickcodes commented on GitHub (Sep 23, 2021): @rationalthinker1 Via: https://github.com/kholia/OSX-KVM/blob/master/notes.md > Use the `sysctl kern.hv_support` (output 1 is good) command to check if Hypervisor is enabled within the macOS VM. > If Hypervisor is not enabled, check that you have the required CPU features. Run the `sysctl -a | grep machdep.cpu.features` command and look for the presence of VMX flag.
Author
Owner

@rationalthinker1 commented on GitHub (Sep 25, 2021):

How do I add the vmx flag? How do i do the following:

Make sure that kvm_intel module is loaded properly. This is documented in our main documentation.

Make sure the VM is booted with VMX support passed through using one of the two below strategies:

You may add vmx,rdtscp arguments to the -cpu option in boot-macOS.sh file (easier option).

You may add +vmx, to the front of MY_OPTIONS in the boot script while changing -cpu Penryn to -cpu Skylake-Client or any other suitable supported CPU.

Note: Host CPU passthrough is troublesome and not generally recommended.

@rationalthinker1 commented on GitHub (Sep 25, 2021): How do I add the vmx flag? How do i do the following: Make sure that kvm_intel module is loaded properly. This is documented in our main documentation. Make sure the VM is booted with VMX support passed through using one of the two below strategies: You may add vmx,rdtscp arguments to the -cpu option in boot-macOS.sh file (easier option). You may add +vmx, to the front of MY_OPTIONS in the boot script while changing -cpu Penryn to -cpu Skylake-Client or any other suitable supported CPU. Note: Host CPU passthrough is troublesome and not generally recommended.
Author
Owner

@rationalthinker1 commented on GitHub (Sep 27, 2021):

Just wanted to give an update. I did get it to work.
I did the following

  • I cloned this project
  • found all references in dockerfiles to Penryn to changed to max.
  • Added +vmx flag in helm.values. Also changed Penryn to max in helm.values

Ran docker build -t docker-osx -f Dockerfile.naked -t docker-osx-custom . in the project folder.

Ran this to start docker-osx

docker run -it \
 --device /dev/kvm \
 -p 50922:10022 \
 -p 24800:24800 \
 -p 222:22 \
 -v "${PWD}/mac_hdd_ng.img:/image" \
 -v /tmp/.X11-unix:/tmp/.X11-unix \
 -e "DISPLAY=${DISPLAY:-:0.0}" \
 -e "NOPICKER=false" \
 -e "RAM=8" \
 -v "/home/raza:/mnt/hostshare" \
 -e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \
 docker-osx-custom
@rationalthinker1 commented on GitHub (Sep 27, 2021): Just wanted to give an update. I did get it to work. I did the following - I cloned this project - found all references in dockerfile**s** to `Penryn` to changed to `max`. - Added `+vmx` flag in `helm.values`. Also changed `Penryn` to `max` in `helm.values` Ran `docker build -t docker-osx -f Dockerfile.naked -t docker-osx-custom . ` in the project folder. Ran this to start docker-osx ``` docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -p 24800:24800 \ -p 222:22 \ -v "${PWD}/mac_hdd_ng.img:/image" \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e "NOPICKER=false" \ -e "RAM=8" \ -v "/home/raza:/mnt/hostshare" \ -e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \ docker-osx-custom ```
Author
Owner

@thematrixdev commented on GitHub (Sep 27, 2021):

Thanks @rationalthinker1 . I am trying out on the same stuff now! Will @sickcodes merge the change if it works? Or I have to follow @rationalthinker1 's guide and build my custom image?

@thematrixdev commented on GitHub (Sep 27, 2021): Thanks @rationalthinker1 . I am trying out on the same stuff now! Will @sickcodes merge the change if it works? Or I have to follow @rationalthinker1 's guide and build my custom image?
Author
Owner

@sickcodes commented on GitHub (Oct 1, 2021):

Just wanted to give an update. I did get it to work.

I did the following

  • I cloned this project

  • found all references in dockerfiles to Penryn to changed to max.

  • Added +vmx flag in helm.values. Also changed Penryn to max in helm.values

Ran docker build -t docker-osx -f Dockerfile.naked -t docker-osx-custom . in the project folder.

Ran this to start docker-osx


docker run -it \

 --device /dev/kvm \

 -p 50922:10022 \

 -p 24800:24800 \

 -p 222:22 \

 -v "${PWD}/mac_hdd_ng.img:/image" \

 -v /tmp/.X11-unix:/tmp/.X11-unix \

 -e "DISPLAY=${DISPLAY:-:0.0}" \

 -e "NOPICKER=false" \

 -e "RAM=8" \

 -v "/home/raza:/mnt/hostshare" \

 -e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \

 docker-osx-custom

Looks good to me, I think it's time to merge the max. Will try and test all the images over the weekend.

Need to test this on all 4 first:

-e MASTER_PLIST_URL= https://raw.githubusercontent.com/sickcodes/OS X-serial-generator/kvm-opencore-14/config-custom.plist \

To merge this for monterey: https://github.com/sickcodes/osx-serial-generator/pull/19

@sickcodes commented on GitHub (Oct 1, 2021): > Just wanted to give an update. I did get it to work. > > I did the following > > - I cloned this project > > - found all references in dockerfile**s** to `Penryn` to changed to `max`. > > - Added `+vmx` flag in `helm.values`. Also changed `Penryn` to `max` in `helm.values` > > > > Ran `docker build -t docker-osx -f Dockerfile.naked -t docker-osx-custom . ` in the project folder. > > > > Ran this to start docker-osx > > > > ``` > > docker run -it \ > > --device /dev/kvm \ > > -p 50922:10022 \ > > -p 24800:24800 \ > > -p 222:22 \ > > -v "${PWD}/mac_hdd_ng.img:/image" \ > > -v /tmp/.X11-unix:/tmp/.X11-unix \ > > -e "DISPLAY=${DISPLAY:-:0.0}" \ > > -e "NOPICKER=false" \ > > -e "RAM=8" \ > > -v "/home/raza:/mnt/hostshare" \ > > -e EXTRA="-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare" \ > > docker-osx-custom > > ``` Looks good to me, I think it's time to merge the `max`. Will try and test all the images over the weekend. Need to test this on all 4 first: `-e MASTER_PLIST_URL= https://raw.githubusercontent.com/sickcodes/OS X-serial-generator/kvm-opencore-14/config-custom.plist \` To merge this for monterey: https://github.com/sickcodes/osx-serial-generator/pull/19
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#246