I'm just getting started with running Docker on macOS. On Linux, there are base OS images like debian:10
and ubuntu:22.04
. Are there similar images for macOS? I've tried searching Docker Hub for "macos" and "sonoma" but haven't found anything that looked like a vanilla OS image.
1 Answer
No - macOS images for docker to run macOS on a Mac aren't provided.
I believe Apple license terms prohibit docker from providing macOS images similar to their Linux distributions. See section 2.J. :
you may not make the Apple Software available over a network where it could be run or used by multiple computers at the same time. Except as expressly permitted in Section 3, you may not rent, lease, lend, sell, redistribute or sublicense the Apple Software.
Section 3 is relatively new and could possibly allow for docker to provide for and adhere to the developer only restrictions written into the license. That would probably require payment, auditing and tooling to satisfy Apple’s pre-approval requirements, however.
For now, you'll want to look to an existing vendor to provide remote testing. Two I can recommend are Mac Stadium and AWS.
If you need locally controlled hardware, script the installer you download into a VM / hypervisor of your choice or perhaps open an issue against docker if you can't figure out how to create your own VM from the installer you download. If you want to read up on written guides and peer/community supported efforts of VM installation of macOS, may I recommend the eclectic light blog and this post specifically on lightweight Mac native hypervisors:
-
It's also worth noting that Apple's EULA for macOS requires it to only run on Apple hardware.– da4Commented Oct 23, 2023 at 16:21
-
I'm not trying to create a VM. I'm trying to set up some testing. My goal is to stand up several containers via docker-compose and test network communication between them. Creating VM's is too heavy-weight when all I need is simple network virtualization. Commented Oct 23, 2023 at 16:26
-
1You may need to test on a VM is my point. I'll edit my post so everyone can see the TLDR - nope. Perhaps you could instead describe (perhaps in a follow on question) the tests you're running and not the proposed solution (being a quick docker install that's not likely to happen IMO) ?– bmike ♦Commented Oct 23, 2023 at 16:39
-
1No one besides Apple has a distribution right for macOS, so no one can legally offer a download. That doesn't stop people from doing it, but Docker is probably a big enough target (and likely has professional-minded staff to avoid this infraction) that Apple would take exception. Commented Oct 23, 2023 at 18:52
-
Apple holds the rights, which they can license out to others. Parallels for Apple Silicon can and does download pre-built macOS VM images from somewhere (see kb.parallels.com/125561). I can't prove that they have a formal agreement with Apple, but they're a respectable enough business that I assume they wouldn't set themselves up to be sued by Apple for pirating macOS.– nobodyCommented Oct 24, 2023 at 1:52