Docker in a macOS VM on an M4: Nested Virtualization Limits
Docker can't run inside a macOS VM on an M4. Run Docker Engine in a Linux VM instead, and turn on Nested Virtualization only if you need KVM.
GuideUpdated 6 min read
On this page
You've set up a macOS VM on a MacBook Air M4, installed Docker Desktop, and it won't start. Parallels and UTM both appear to lack nested virtualization, so you're asking what else you can do.
We make Hermitbox, so weigh our view accordingly. The advice below applies to any Mac virtualization app. The Hermitbox steps cover the Linux route.
Why Docker fails inside a macOS VM
Docker Desktop on a Mac runs containers inside its own small Linux VM. Inside a macOS guest, that means a VM inside a VM, which is nested virtualization. The guest has to be able to use the hardware virtualization features itself.
For macOS guests it can't, and the limit sits in Apple's framework rather than in any one app. A person who installed Docker Desktop in a Virtualization framework macOS VM reported a hypervisor check failure. On Apple's developer forums, the reply said this is expected: neither the Virtualization framework nor the Hypervisor framework works from inside the VM, and no setup enables them. Another developer's recent forum post makes the same point from the API side. The framework exposes nested virtualization on its generic (Linux) platform configuration, and the Mac guest configuration has no equivalent option.
The causes, most common first:
- The guest is macOS. No nesting is available, on any chip.
- The chip is M1 or M2. Apple's developer forums include a reply confirming that nested virtualization needs an M3 processor.
- The host is on macOS 14. Hermitbox shows its Linux nesting switch only on macOS 15 or later.
- The app uses a different hypervisor. Parallels' own knowledge base says nested virtualization isn't supported for the Apple hypervisor or for macOS virtual machines, on Intel and Apple silicon Macs. Its nested virtualization article also says nested Hyper-V isn't supported on Apple silicon. That article was last reviewed in October 2024, so check Parallels' current pages before you buy for this purpose.
We haven't confirmed UTM's current nesting behavior. A reply in the thread you may have read cited a UTM GitHub issue, which is a place to check for status.
Pick the setup that fits
| What you need | Use this | Needs nesting? |
|---|---|---|
| Containers isolated from your main system, easy to snapshot | Docker Engine in a Linux VM | No |
| Containers with the least overhead | Docker running on the Mac itself | No |
| VMs (KVM) inside Linux | Linux VM with Nested Virtualization on | Yes (M3 or later, macOS 15+) |
| Docker Desktop inside macOS, specifically | A second physical Mac, such as a Mac mini | No, it runs on real hardware |
Pick the Linux VM if you want Docker kept apart from your main system. Pick Docker on the Mac if you want the lightest option. OrbStack is one app for that: as of November 2026 it is free for personal use and paid for commercial use.
If the reason for the macOS guest was something else (testing a Mac app, say), keep the macOS VM for that. Run the containers in a Linux VM beside it. Both can run at once, since only macOS guests count toward Apple's two-VM limit.
Run Docker in a Linux VM with Hermitbox
This works on an Apple silicon Mac with macOS 14 or later. Nested virtualization isn't required.
Create the VM
- Open Hermitbox and choose File > New VM… (⌘N).
- Choose Linux, then Continue.
- Under Ready in a Minute, pick Ubuntu Server 26.04 LTS. Debian 13 and Fedora Cloud 45 are also there.
- On Name and Size, set User and Password. The password is optional if you have a public key matching
~/.ssh/id_*.pub. Leave Allow SSH with this Mac's key(s) on. - Raise Disk above the recommended 32 GB if you'll pull many images. Disks can only grow later, never shrink.
- Click Create, then start the VM. It configures itself on first boot, with SSH ready.
Connect and install Docker
- Select the VM and open the inspector (⌃⌘I).
- In Connect, use the Open SSH menu and choose Open in Terminal.
- Install Docker Engine by following the steps for your distribution in Docker's official Engine installation documentation.
- Check that it works:
sudo docker run hello-worldThis pulls Docker's small test image and runs it. It leaves the image and a stopped container behind. Drop sudo if you've added your user to the docker group.
To reach a container's published port from your Mac, use the VM's address, not localhost. Copy IP Address in Connect gives you it. If it says "Waiting for an address…", wait a few seconds.
Turn on nested virtualization for a Linux VM
You only need this if something inside Linux needs KVM (for example, running VMs within the Linux guest). Ordinary Docker containers don't.
Before you start: the switch appears only for Linux VMs, on macOS 15 or later, on hardware that supports nesting. Hermitbox's own notes point to the M3 or later. Apple's Virtualization framework exposes this as a supported/enabled property on the generic platform configuration, which is what Linux guests use.
- Shut the Linux VM down. The switch is off while it's running.
- Select the VM and open the inspector (⌃⌘I).
- Turn on Nested Virtualization. The help text reads "Lets Linux run its own VMs (KVM). Takes effect the next time it starts."
- If the VM is suspended, Hermitbox asks before discarding its saved state. Confirm only if you can lose unsaved work in it.
- Start the VM and check inside Linux:
ls -l /dev/kvmThis only lists a file. If /dev/kvm exists, Linux sees KVM. The switch is off by default.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| No Nested Virtualization switch | VM isn't Linux, host is macOS 14, or chip is M1/M2 | Use a Linux VM on macOS 15+ with an M3 or later |
| Switch can't be changed | VM is running | Shut it down, change it, start it again |
/dev/kvm missing | VM not restarted since the change | Start the VM again after enabling the switch |
| Can't reach a container from the Mac | Using localhost | Use the VM's IP and check the container publishes the port |
| Out of disk in the VM | Disk too small | VM Settings… > Hardware, grow Disk with the VM shut down, then extend the partition in Linux |
| Builds run out of memory | Low Memory | Raise Memory in VM Settings > Hardware with the VM shut down |
Checklist before you try again
- The VM you're troubleshooting is Linux, not macOS.
- The Mac is on macOS 15 or later if you need nesting, and has an M3 or newer chip.
- The VM was shut down when you changed the switch, then started again.
- You connect to containers by the VM's IP address.
If nothing works
If the switch is missing on a Mac that should support it, or /dev/kvm never appears, contact MacSuite support through the support page. Include your Mac model, macOS version, Hermitbox version, the guest distribution, and what you already tried.
Subject: Nested Virtualization switch missing / no /dev/kvm
Mac: MacBook Air M4, macOS (your version)
Hermitbox version: (your version)
VM: Linux, (distribution and version), shut down before changes
Problem: The Nested Virtualization switch is not shown / is on but /dev/kvm is missing after restart.
Already tried: shut down, toggled the switch, started again.Common questions
Can any Mac virtualization app run Docker Desktop inside a macOS VM on Apple silicon?
Not through nesting, based on Apple's framework limits above. A second physical Mac is the dependable route for Docker Desktop inside macOS.
Does an M4 help?
The M4 supports nesting for Linux guests (M3 and later do). It doesn't change the macOS guest limit.
Does Hermitbox include Docker?
No. In the published 1.0.0 build it gives you the Linux VM, and you install Docker Engine yourself.
Will Windows or Intel guests work for this?
Not in Hermitbox. It has no Windows or x86-64 guests.
Where Hermitbox fits
Hermitbox covers the Linux half of this: a Linux VM in about a minute, SSH from the inspector, snapshots before risky changes, and the nesting switch where the hardware allows it. It can't give a macOS guest nesting, and no app on Apple silicon can. Hermitbox is part of MacSuite and you can try it free for 7 days. See the Hermitbox page, the Hermitbox Linux guide, or how to run Linux on a Mac.