Multipass VMs on macOS
I'm in the process of developing a demo for my students. I need to show them how we'll do Docker based deployments in the cloud, and I wanted to quickly create a small cluster of VMs on my M1 MacBook Pro. I debated doing it in AWS, but decided that for the purposes of this group, using local VMs would be more accessible.
So I took another look into the macOS M1/M2 virtualization ecosystem. It's been a while since I explored this space, and the last time I looked, it wasn't really ready for Apple Silicon.
First, I looked at VMware Fusion. I've used (and liked) VMware in the past. It looks like this will cost something like ~$150-$200. So I looked into Parallels, and this is similar in cost, but per year vs one-time! I'm sure that Parallels has an amazing user experience, but it's not worth it to me.
Next I went to look if my old friend VirtualBox had M1/M2 support yet. It turns out that there is a developer preview! I downloaded and installed it, then started installing a VM. It crashed 4 times before I gave up.
Next I tried UTM, which I've read about but never used. It's based on QEMU, but you can also opt into using experimental support for Apple's native M1/M2 virtualization kit. I downloaded it and created a few VMs. Mostly, it worked great. I found that I could use the experimental Apple virtulization vs. qemu with no problems (zero crashes). But I couldn't get the networking between VMs and the host to ever work exactly how I wanted.
Finally, I decided to go looking for the Ubuntu virtualization tool I'd read about a while ago. It took me a while to Google my way to success, but eventually I found Canoncial's Multipass. I'd read about this previously while researching my AWS course (I think while reading about cloud-init).
Multipass turned out to be exactly the tool I needed. It's a little like using Docker, with a single command line tool and macOS menu bar app to control starting/stopping and shelling into VMs.
In my case, I want to spin up 3 Ubuntu VMs configured to use Docker. I can do it like so:
$ multipass launch --name manager docker
$ multipass launch --name worker1 docker
$ multipass launch --name worker2 docker
This pulls the images and you get VMs with 1GB RAM, 5GM disk, and 1CPU (all easily configurable via args to launch), and your home directory mounted inside the VMs. You can get shell access like so: multipass shell worker1
and when you're done, multipass stop
or multipass delete
to remove your instance(s). And the networking all works without hassle!
The docs are excellent, and I ran into zero issues while building my demo. I even filed a feature request, and was greeted immediately by the community with a positive response.
I'd recommend checking out Multipass. It's impressive.