OSX (macOS) inside a Docker container.
\nFeatures āØ
\n- \n
- KVM acceleration \n
- Web-based viewer \n
- Automatic download \n
Usage š³
\nVia Docker Compose:
\nservices:\n macos:\n image: dockurr/macos\n container_name: macos\n environment:\n VERSION: \"13\"\n devices:\n - /dev/kvm\n cap_add:\n - NET_ADMIN\n ports:\n - 8006:8006\n - 5900:5900/tcp\n - 5900:5900/udp\n stop_grace_period: 2m
Via Docker CLI:
\ndocker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 120 dockurr/macos
Via Kubernetes:
\nkubectl apply -f https://raw.githubusercontent.com/dockur/macos/refs/heads/master/kubernetes.yml
Compatibility āļø
\n| Product | \nPlatform | \n\n |
|---|---|---|
| Docker Engine | \nLinux | \nā | \n
| Docker Desktop | \nLinux | \nā | \n
| Docker Desktop | \nmacOS | \nā | \n
| Docker Desktop | \nWindows 11 | \nā | \n
| Docker Desktop | \nWindows 10 | \nā | \n
FAQ š¬
\nHow do I use it?
\nVery simple! These are the steps:
\n- \n
- \n
Start the container and connect to port 8006 using your web browser.
\n \n - \n
Choose
\nDisk Utilityand then select the largestApple Inc. VirtIO Block Mediadisk. \n - \n
Click the
\nErasebutton to format the disk to APFS, and give it any recognizable name you like. \n - \n
Close the current window and proceed the installation by clicking
\nReinstall macOS. \n - \n
When prompted where you want to install it, select the disk you just created previously.
\n \n - \n
After all files are copied, select your region, language, and account settings.
\n \n
Enjoy your brand new machine, and don't forget to star this repo!
\nHow do I select the macOS version?
\nBy default, macOS 13 (Ventura) will be installed, as it offers the best performance.
\nBut you can add the VERSION environment variable to your compose file, in order to specify an alternative macOS version to be downloaded:
environment:\n VERSION: \"13\"
Select from the values below:
\n| Value | \nVersion | \nName | \n
|---|---|---|
15 | \nmacOS 15 | \nSequoia | \n
14 | \nmacOS 14 | \nSonoma | \n
13 | \nmacOS 13 | \nVentura | \n
12 | \nmacOS 12 | \nMonterey | \n
11 | \nmacOS 11 | \nBig Sur | \n
How do I change the storage location?
\nTo change the storage location, include the following bind mount in your compose file:
\nvolumes:\n - /var/osx:/storage
Replace the example path /var/osx with the desired storage folder.
How do I change the size of the disk?
\nTo expand the default size of 64 GB, add the DISK_SIZE setting to your compose file and set it to your preferred capacity:
environment:\n DISK_SIZE: \"256G\"
Tip
This can also be used to resize the existing disk to a larger capacity without any data loss.
\nHow do I change the amount of CPU or RAM?
\nBy default, the container will be allowed to use a maximum of 2 CPU cores and 4 GB of RAM.
\nIf you want to adjust this, you can specify the desired amount using the following environment variables:
\nenvironment:\n RAM_SIZE: \"8G\"\n CPU_CORES: \"4\"
How do I pass-through a USB device?
\nTo pass-through a USB device, first lookup its vendor and product id via the lsusb command, then add them to your compose file like this:
environment:\n ARGUMENTS: \"-device usb-host,vendorid=0x1234,productid=0x1234\"\ndevices:\n - /dev/bus/usb
How do I verify if my system supports KVM?
\nOnly Linux and Windows 11 support KVM virtualization, macOS and Windows 10 do not unfortunately.
\nYou can run the following commands in Linux to check your system:
\nsudo apt install cpu-checker\nsudo kvm-ok
If you receive an error from kvm-ok indicating that KVM cannot be used, please check whether:
- \n
- \n
the virtualization extensions (
\nIntel VT-xorAMD SVM) are enabled in your BIOS. \n - \n
you enabled \"nested virtualization\" if you are running the container inside a virtual machine.
\n \n - \n
you are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's.
\n \n
If you do not receive any error from kvm-ok but the container still complains about KVM, please check whether:
- \n
- \n
you are not using \"Docker Desktop for Linux\" as it does not support KVM, instead make use of Docker Engine directly.
\n \n - \n
it could help to add
\nprivileged: trueto your compose file (orsudoto yourdocker runcommand), to rule out any permission issue. \n
How do I run Windows in a container?
\nYou can use dockur/windows for that. It shares many of the same features, and even has completely automatic installation.
\nIs this project legal?
\nYes, this project contains only open-source code and does not distribute any copyrighted material. Neither does it try to circumvent any copyright protection measures. So under all applicable laws, this project will be considered legal.
\nHowever, by installing Apple's macOS, you must accept their end-user license agreement, which does not permit installation on non-official hardware. So only run this container on hardware sold by Apple, as any other use will be a violation of their terms and conditions.
\nAcknowledgements š
\nSpecial thanks to seitenca, this project would not exist without her invaluable work.
\nStars š
\n\nDisclaimer āļø
\nOnly run this container on Apple hardware, any other use is not permitted by their EULA. The product names, logos, brands, and other trademarks referred to within this project are the property of their respective trademark holders. This project is not affiliated, sponsored, or endorsed by Apple Inc.
\n