Docker in mac Virtual machine #236

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

Originally created by @Animezjy on GitHub (Aug 23, 2021).

I want to start docker in a mac virtual machine.
How do I set up hardware virtualization I have successfully installed the mac virtual machine?

Originally created by @Animezjy on GitHub (Aug 23, 2021). I want to start docker in a mac virtual machine. How do I set up hardware virtualization I have successfully installed the mac virtual machine?
Author
Owner

@omarahm3 commented on GitHub (Aug 25, 2021):

I'm having the same issue, running latest docker on guest will throw "Incompatible CPU detected error" and that it requires a processor with virtualization and hypervisor support.
@sickcodes any idea how to have this done? i'm using Big Sur BTW

@omarahm3 commented on GitHub (Aug 25, 2021): I'm having the same issue, running latest docker on guest will throw "Incompatible CPU detected error" and that it requires a processor with virtualization and hypervisor support. @sickcodes any idea how to have this done? i'm using Big Sur BTW
Author
Owner

@sickcodes commented on GitHub (Aug 26, 2021):

https://github.com/KhaosT/MacVM

This works on Monterrey M1 hardware, I would like to test it this week on virtual

Edit: failed on Ryzen, unaware of Intel results though

@sickcodes commented on GitHub (Aug 26, 2021): https://github.com/KhaosT/MacVM This works on Monterrey M1 hardware, I would like to test it this week on virtual Edit: failed on Ryzen, unaware of Intel results though
Author
Owner

@omarahm3 commented on GitHub (Aug 26, 2021):

@sickcodes It worked after applying changes from here https://github.com/sickcodes/Docker-OSX/pull/312 and just:

docker run -it --device /dev/kvm -p 50922:10022 -v ~/mac_hdd_ng_auto_big_sur.img:/image -v /tmp/.X11-unix:/tmp/.X11-unix -e 'NOPICKER=false' -e 'DISPLAY=:0' -e 'RAM=half'  sickcodes/docker-osx:naked
@omarahm3 commented on GitHub (Aug 26, 2021): @sickcodes It worked after applying changes from here https://github.com/sickcodes/Docker-OSX/pull/312 and just: ``` docker run -it --device /dev/kvm -p 50922:10022 -v ~/mac_hdd_ng_auto_big_sur.img:/image -v /tmp/.X11-unix:/tmp/.X11-unix -e 'NOPICKER=false' -e 'DISPLAY=:0' -e 'RAM=half' sickcodes/docker-osx:naked ```
Author
Owner

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

I need to run Docker or Virtualbox on Docker-OSX as well.
As far as I understand from @omarking05 's lastest message, cpu=max is already merged in the latest release.
The virtual CPU could not be identified to be KVM compatible.
Even I am specifying this, it does not work neither.

I am using docker-compose up instead of running the command line for ease of future modification.

version: '3.8'
services:
macosx:
container_name: macosx
image: sickcodes/docker-osx:big-sur
devices:
- /dev/kvm:/dev/kvm
ports:
- 50922:10022
- 51820:51820/udp
volumes:
- /home/user/Downloads:/mnt/hostshare
- /tmp/.X11-unix:/tmp/.X11-unix
- data:/home
environment:
- CPU=max
- RAM=4
- NETWORKING=vmxnet3
- DISPLAY=${DISPLAY:-:0.0}
- GENERATE_UNIQUE=true
- WIDTH=1280
- HEIGHT=720
- ADDITIONAL_PORTS=hostfwd=udp::51820-:51820
- EXTRA=-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare
privileged: true
cap_add:
- ALL
volumes:
data:

May I know what have I done wrongly?

@thematrixdev commented on GitHub (Sep 24, 2021): I need to run Docker or Virtualbox on Docker-OSX as well. As far as I understand from @omarking05 's lastest message, `cpu=max` is already merged in the latest release. The virtual CPU could not be identified to be KVM compatible. Even I am specifying this, it does not work neither. I am using `docker-compose up` instead of running the command line for ease of future modification. > version: '3.8' services: macosx: container_name: macosx image: sickcodes/docker-osx:big-sur devices: - /dev/kvm:/dev/kvm ports: - 50922:10022 - 51820:51820/udp volumes: - /home/user/Downloads:/mnt/hostshare - /tmp/.X11-unix:/tmp/.X11-unix - data:/home environment: - CPU=max - RAM=4 - NETWORKING=vmxnet3 - DISPLAY=${DISPLAY:-:0.0} - GENERATE_UNIQUE=true - WIDTH=1280 - HEIGHT=720 - ADDITIONAL_PORTS=hostfwd=udp::51820-:51820 - EXTRA=-virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=passthrough,id=hostshare privileged: true cap_add: - ALL volumes: data: May I know what have I done wrongly?
Author
Owner

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

qemu-system-x86
-cpu max,vendor=GenuineIntel \
-machine q35,${KVM-"accel=kvm:tcg"} \

I am considering the following changes.

VMX doesn't show up, but apparently it should work on Intel.

I will give it a test on Digital Ocean, which lets you select AMD or Intel, unless someone wants to.

@sickcodes commented on GitHub (Sep 24, 2021): ``` qemu-system-x86 -cpu max,vendor=GenuineIntel \ -machine q35,${KVM-"accel=kvm:tcg"} \ ``` I am considering the following changes. VMX doesn't show up, but apparently it should work on Intel. I will give it a test on Digital Ocean, which lets you select AMD or Intel, unless someone wants to.
Author
Owner

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

Making - EXTRA=-cpu max,vendor=GenuineIntel -M q35,accel=kvm, Docker-OSX "boots-loop".
May you please take a look on this?
image

@thematrixdev commented on GitHub (Sep 27, 2021): Making `- EXTRA=-cpu max,vendor=GenuineIntel -M q35,accel=kvm`, Docker-OSX "boots-loop". May you please take a look on this? ![image](https://user-images.githubusercontent.com/19472561/134835362-a20539c8-ee24-474c-bc86-61fe9b29b95d.png)
Author
Owner

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

I can use QEMU without hardware acceleration. If anyone needs Docker you may take a look on this issue:
https://github.com/sickcodes/Docker-OSX/issues/346

@thematrixdev commented on GitHub (Sep 27, 2021): I can use QEMU without hardware acceleration. If anyone needs Docker you may take a look on this issue: https://github.com/sickcodes/Docker-OSX/issues/346
Author
Owner

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

Making - EXTRA=-cpu max,vendor=GenuineIntel -M q35,accel=kvm, Docker-OSX "boots-loop". May you please take a look on this? image

This won't work as it's already defined above in the variable called CPU

This will work though (testing rn):

-e CPU=max \
-e CPUID_FLAGS='vendor=GenuineIntel' \
@sickcodes commented on GitHub (Sep 29, 2021): > Making `- EXTRA=-cpu max,vendor=GenuineIntel -M q35,accel=kvm`, Docker-OSX "boots-loop". May you please take a look on this? ![image](https://user-images.githubusercontent.com/19472561/134835362-a20539c8-ee24-474c-bc86-61fe9b29b95d.png) This won't work as it's already defined above in the variable called CPU This will work though (testing rn): ``` -e CPU=max \ -e CPUID_FLAGS='vendor=GenuineIntel' \ ```
Author
Owner

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

It boots only without setting CPU=max.
With CPU=max set it just keeps bootloop.

version: '3.8'
services:
osx:
container_name: osx
image: sickcodes/docker-osx:big-sur
devices:
- /dev/kvm
ports:
- 222:222/tcp
- 2222:2222/tcp
- 5999:5999/tcp
- 51821:51821/udp
volumes:
- /home/y2kbug/Downloads:/mnt/hostshare
- /tmp/.X11-unix:/tmp/.X11-unix
- home:/home
environment:
#- CPU=max
- "CPUID_FLAGS=vendor=GenuineIntel"
- RAM=4
- SMP=4
- NETWORKING=vmxnet3
- DISPLAY=${DISPLAY:-:0.0}
- WIDTH=1920
- HEIGHT=1080
- GENERATE_UNIQUE=true
- ADDITIONAL_PORTS=hostfwd=tcp::222-:22,hostfwd=tcp::2222-:2222,hostfwd=udp::51821-:51821
- "EXTRA=-M q35,accel=kvm -display none -vnc 0.0.0.0:99 -virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=pas>
privileged: true
cap_add:
- ALL
volumes:
home:

@thematrixdev commented on GitHub (Sep 30, 2021): It boots only without setting `CPU=max`. With `CPU=max` set it just keeps bootloop. > version: '3.8' services: osx: container_name: osx image: sickcodes/docker-osx:big-sur devices: - /dev/kvm ports: - 222:222/tcp - 2222:2222/tcp - 5999:5999/tcp - 51821:51821/udp volumes: - /home/y2kbug/Downloads:/mnt/hostshare - /tmp/.X11-unix:/tmp/.X11-unix - home:/home environment: #- CPU=max - "CPUID_FLAGS=vendor=GenuineIntel" - RAM=4 - SMP=4 - NETWORKING=vmxnet3 - DISPLAY=${DISPLAY:-:0.0} - WIDTH=1920 - HEIGHT=1080 - GENERATE_UNIQUE=true - ADDITIONAL_PORTS=hostfwd=tcp::222-:22,hostfwd=tcp::2222-:2222,hostfwd=udp::51821-:51821 - "EXTRA=-M q35,accel=kvm -display none -vnc 0.0.0.0:99 -virtfs local,path=/mnt/hostshare,mount_tag=hostshare,security_model=pas> privileged: true cap_add: - ALL volumes: home:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#236