I’m running a Molecule test against a container running in Docker Desktop locally. When I set gather_facts to true in converge.yml Docker crashes hard with the error Com.apple.Virtualization.VirtualMachine crashed covering the screen, with no option to click it away, restart is the only recovery.
Using molecule 6.0.3 and also docker 7.0.0 libraries didn’t help. I’m suspecting this might have something that the ubi7 image is amd64 and to make it work I set the platform to amd64. My Mac has an arm64 M2 chip so some sort of emulation has to happen. I wonder if this is failing badly.
I found some consistency. The crash happens when the image used by Molecule is UBI which is only AMD64 ie no ARM64 image. I needed to set privileged: true in order to get systemd to work. When I set privileged: false the crash doesn’t happen, but my use case can’t be tested. I found that if I use colima (GitHub - abiosoft/colima: Container runtimes on macOS (and Linux) with minimal setup) instead of Docker Desktop, this issue goes away.
Just as a note in case someone reading this isn’t aware of it: privileged: true is similar to running something with sudo - you basically give the container full access to the machine, and code running in it can escape from the container. So only use it if you’re really sure it’s OK and safe.