11 ms·
Docker-OSX: Run macOS VM in a Docker
- tambourine_man 4y agoIt’s not clear to me if it’s graphic accelerated. GPU pass through or similar tricks.
- satvikpendem 4y agoGPU acceleration is in their Todo section
- tambourine_man 4y agoThanks, that's the turning point for making it truly good for everyday use rather than an experimental project.
- AnthonBerg 4y agoTo my knowledge, there are two ways to get accelerated graphics in a macOS VM: GPU passthrough, and paravirtualized GPU. GPU passthrough from a Linux host to a Mac VM is already possible. Even with Docker in the sandwich. Then it’s a question of Docker-OSX being furnished for it. I believe the GPU passthrough foundation is already there: PR #132: https://github.com/sickcodes/Docker-OSX/pull/132 https://github.com/sickcodes/Docker-OSX/pull/132 ”[…] this PR introduces GPU passthrough support. This requires extensive configuration on the host” — Then there’s “paravirtualized” graphics. I don’t get the name; as far as I know, this is when the guest OS has a virtual graphics device and a driver for it – with acceleration — and the virtual graphics device is actually served and accelerated like any other graphics-accelerated software by a GPU on the host. As mentioned elsewhere, paravirtualized graphics are available on mac-host-to-mac-guest, and to my knowledge only mac-inside-mac. (But the “outside” mac can probably be a virtual machine as long as it has a GPU. Even if it’s a passthrough device. Should be technically possible at least and I would guess that it just works.) Finally, un-accelerated graphics in a macOS VM are surprisingly fast these days. At least on my Linux machine in qemu-kvm, recent versions of kernel / qemu etc. It’s noticeably slower than having properly accelerated graphics but muuuuch faster than I was expecting from macOS VMs I’ve used before. Finally, headless access to virtualized macOS goes really fast. Working on a mac VM through mosh-shell is excellent.
- britneybitch 4y agoI hate to give Apple any ideas... but I've always wondered why macOS/iOS support falling back to software rendering, when all of their devices ship with a known GPU configuration. Without that fallback, getting the OS running on non-Apple hardware would take a lot more work.
- spijdar 4y agoPresumably they use it internally. IIRC there are drivers for VirtIO devices in modern MacOS, implying they use KVM/QEMU for something.
- BudaDude 4y agoI would imagine battery life may be a part of it
- cmeacham98 4y agoApple has documentation on installing OS X in a VM: https://developer.apple.com/documentation/virtualization/installing_macos_on_a_virtual_machine https://developer.apple.com/documentation/virtualization/ins... While _this_ usecase obviously isn't officially supported, it does seem like they support VMs in some capacity officially.
- shortformblog 4y agoI did an interview with Sickcodes a couple of years ago when this first emerged. He does extremely interesting stuff and his point of view is unique. https://www.vice.com/en/article/akdmb8/open-source-app-lets-anyone-create-a-virtual-army-of-hackintoshes https://www.vice.com/en/article/akdmb8/open-source-app-lets-...
- nier 4y agoThis is the first time I read about this. How on earth is this not an April’s fools joke? Apple allows you to run a maximum of 2 virtual machines on Apple hardware. Someone is going to get sued by Apple for going against this part of the license agreement and I must say I really like that thought because the result of that trial will give clarity to the rest of us. We had to deal with a gray area in our project as well. DeepL does not allow use of their translator in critical infrastructure. Our client is in the transportation business and has been using DeepL for years to translate emails. They wanted to integrate DeepL into a customer portal that we develop for them. When we told them that we will not be complicit in breaking DeepL’s license agreement, they weren’t too happy.
- userbinator 4y agoApple has largely left the Hackintosh community alone. It seems like they're not interested in going after anything but those trying to commercialise it: https://en.wikipedia.org/wiki/Psystar_Corporation https://en.wikipedia.org/wiki/Psystar_Corporation
- philjohn 4y agoIt won't be an issue for much longer - once support is phased out for Intel-based macs they'll be left behind.
- userbinator 4y agoDon't underestimate the Hackintosh community --- if they could create an SSSE3 emulator to allow installing macOS on CPUs that didn't even have the required instructions, and completely rebuild kernels too, I don't think getting macOS to run on whatever other non-Apple ARM system happens to become popular is out of the question. Shortly after the M1 released, this happened: https://news.ycombinator.com/item?id=25064593 https://news.ycombinator.com/item?id=25064593
- Kab1r 4y agoEverytime I tried to use this project, I ran into trouble with iCloud logins persisting across boots
- pfoof 4y agoMicrosoft supports Windows in Docker natively (assuming win host) so what the hell are they waiting for, this would help in CI so much *they = Apple
- deleted 4y ago[deleted]
- TylerE 4y agoThey’re a hardware company. They want to sell Macs.
- pxc 4y agoGreat question, but pretty much a completely different use case than the OP. The whole point of this project is to make it easy to run macOS on foreign host operating systems, presumably because the intended user does not own a Mac. If I had to venture a guess as to why macOS doesn't support its own containers in any way, though, I'd say: The core use case for containers is deploying apps to servers, and macOS isn't really used on the server. Apple themselves abandoned supporting macOS as a server operating system many years ago.
- pfoof 4y ago>The core use case for containers is deploying apps to server Which includes servers that build applications with Xcode.
- 4y ago
- pxc 4y agoOk, so this is just OSX-KVM with extra steps. Seems like a very weird use case for Docker, but okay.
- BHSPitMonkey 4y agoSurely you mean fewer steps (e.g. "docker run [image]" versus the long set of prep/install steps in the OSX-KVM README)?
- tjbiddle 4y agoIIRC, when compiling any iOS apps, etc. you need a Mac machine. I remember in the past, when I was creating CI/CD pipelines we had to ensure that there was a Mac Mini or some other machine that we had access to in order to automate this. Seems like this solution would make it much simpler, as we used Docker for everything else.
- devmor 4y agoI wonder how the performance is compared to a mac mini.
- thejosh 4y agoI recently wanted to build Python wheels for a whole bunch of Python versions and packages on Mac ARM64. I ended up using OSX-KVM, and then using cibuildwheel to crossbuild to arm64. Pretty dang easy. I set up OSX-KVM (https://github.com/kholia/OSX-KVM https://github.com/kholia/OSX-KVM) and it worked really well. Having archlinux is a huge plus for this (it's why the docker image uses it), as qemu is super simple to setup and get running. Was surprised how easy it was, but given how much effort the bootloaders have had over the recent years for Hackintosh, qemu users can just yoink that bootloader and use it.
- SillyUsername 4y agoCan someone explain why I'd use this instead of a regular VM please?
- lapser 4y agoThis is a regular VM. Specially it's qemu-kvm. The difference being that this is running qemu-kvm inside a container (remember, containers are mostly just processes). The advantage this gives you is that your run command is much simpler than the alternative.
- pxc 4y agoBecause you don't know how to configure KVM or don't want to bother, I guess. This project just wraps another project for setting up normal KVM guests running macOS.
- deleted 4y ago[deleted]
- trollian 4y agoThis should be called "Docker for Mac".
- lioeters 4y agoSurely you mean Mac Subsystem for Docker.
- efrecon 4y agoLoL
- hackernudes 4y agoWouldn't that be Docker Subsystem for Mac? DSM, WSL, WTF?
- moralestapia 4y agoGreat find, thanks! I've set up some tests that require OS X and usually set up remote VMs for that. This could be a nice alternative to run those using regular (and cheaper) linux instances. I know you can do the same with KVM but nothing beats a one liner command.
- sally_glance 4y agoCould be or is? Please drop a result once you tried it :)
- monkpit 4y agoIs anyone using it in for production software? Are there any legal issues? I’ve considered using this for running simulators but I always get asked about how legal this is.
- remram 4y agoI'm not sure why you are getting downvoted. I personally wouldn't have any scruples using this for testing/building OSS, but I would also think twice about using it at my job.
- spijdar 4y agoThe general consenus I've seen is that 1) projects/code that enables MacOS to be emulated is legal, but 2) running MacOS VMs on non-Apple hardware is a violation of the EULA you agree to when installing MacOS. So if it's on an Apple device (even one not running MacOS as the host) it's fine, otherwise it's a violation of the EULA, and something a business probably doesn't want to get tangled in.
- monkpit 4y agoThank you!
- monkpit 4y agoTo clarify, by simulators I meant: iOS simulators running under a Linux docker host.
- anthlax 4y agoCan the method of generating MacOS serial tooens be used for iMessage on android??
- kaladin-jasnah 4y agoYes. But it has been very unstable for me and broke iMessage on my Apple branded Mac. The answer is if you have enough patience and luck, it'll work.
- xrd 4y agoAnyone building, signing and notarizing osx software inside this? I've got two machines dedicated for that and am terrified if they fail I'll never remember how to set them up. This could be game changing.
- pugz 4y agoIt might be less effort to use something like this: https://gregoryszorc.com/blog/2021/04/14/pure-rust-implementation-of-apple-code-signing/ https://gregoryszorc.com/blog/2021/04/14/pure-rust-implement... Might even be able to modify `gon` to use that instead of Apple's `codesign` and then you'll have notarization too: https://github.com/mitchellh/gon https://github.com/mitchellh/gon
- thenickdude 4y agoI'm successfully notarizing software inside a QEMU macOS VM, so the same thing in the backend. I'm not submitting to the app store though.
- password4321 4y agohttps://news.ycombinator.com/item?id=32386762 https://news.ycombinator.com/item?id=32386762
- stevebmark 4y agoShould this work on Mac (using Docker Desktop for Mac)? I don't see why not, but trying to run it results in: > docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory.
- deleted 4y ago[deleted]
- bityard 4y agoKVM is a Linux hypervisor
- stevebmark 4y agoI don't follow. Docker for Mac uses a Linux VM
- pxc 4y agoIt's hardware-accelerated paravirtualization. You can't just use that inside an arbitrary VM. Every layer (hardware, host OS, every guest OS but the last in the chain) has to support 'nested virtualization', and you have to enable/configure it. On Linux, this project doesn't require nested virtualization. On any other operating system, it does. In that way, the host OS ends up mattering. Docker Desktop makes me wanna scream.
- cpuguy83 4y agoIt's possible docker4mac doesn't enable nested virt?
- moondev 4y agoFun fact: apple silicon doesn't support nested virt
- stevebmark 4y ago
- randompi 4y agoBut why? Whats the use case?
- stingraycharles 4y agoI can imagine this being useful for CI builds, for instance. On the other hand, this is probably against Apple’s license agreement, so businesses would want to stay away from it.
- fulafel 4y agoSome people need to run macOS-only software, this potentially makes it a bit less painful than the alternatives for the same reason containerized versions of other finicky setups do. In the README there's a blurb with: > Run Mac OS X in Docker with near-native performance! X11 Forwarding! iMessage security research! iPhone USB working! macOS in a Docker container! > Conduct Security Research on macOS using both Linux & Windows!
- cedws 4y agoNitpick but macOS hasn't been "OS X" for many years now.
- aequitas 4y agoThis is a pet peeve of mine, just macOS is infinitely more searchable than all the ways you can spell Mac OS X, macosx, osx, OS X, mac-os-x, I've seen them all at least once. You either always and up with to much results because os and x match to many things, or to little because an exact match on Mac OS X excludes all the other ways people write it.
- fulafel 4y agoIs there something Docker specific in this or would it work with Podman or other container runtimes?
- FlyingSnake 4y agoCan this be used to run CI/CD in Docker for iOS projects? If that’s possible then it’s huge. Edit: Best way to know is to just do it. I’ll try this and report back.
- jbverschoor 4y agohttps://developer.apple.com/xcode-cloud/ https://developer.apple.com/xcode-cloud/ ;-)
- nazka 4y agoOh wow I didn’t know about that. That’s huge. I remember people some time ago buying dozens of Macs to create their own CI/CD with racks of half open MacBooks running 24/365. Great they have that now!
- FlyingSnake 4y agoI'm aware of this but I'm looking more into ephemeral docker containes that builds an iOS app and runs XCTests. Something like Gitlab CI for Android¹ 1: https://hub.docker.com/r/jangrewe/gitlab-ci-android https://hub.docker.com/r/jangrewe/gitlab-ci-android
- psnehanshu 4y agoReally eager to know if this works. But I don't have the capability "yet" to do it myself.
- preisschild 4y agoTechnically yes, but this is against Apples EULA and they could ban your apps from the Appstore for it.
- netsharc 4y agoHe seems to have made some typos in the readme, because some sentences end with a period instead of an exclamation mark!
- timvisee 4y agoCan this be (safely) used without an Apple developer account or signing a contract?
- sroussey 4y agoGreat, so can this be used to have stable diffusion in a container on a Mac and still be able to use M2 GPU and Metal acceleration?
- top_sigrid 4y agoThis is not, what this is about. This is about running macOS in a docker container on another system - most likely Linux or Windows.
- mosselman 4y agoCan you then install docker on that macos and run macos again within that docker?