{"title":"","byline":"dockur","dir":null,"lang":null,"content":"
\n

OSX (macOS) inside a Docker container.

\n

Features ✨

\n
    \n
  • KVM acceleration
  • \n
  • Web-based viewer
  • \n
  • Automatic download
  • \n
\n

Usage 🐳

\n

Via Docker Compose:

\n
services:\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
\n

Via Docker CLI:

\n
docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 120 dockurr/macos
\n

Via Kubernetes:

\n
kubectl apply -f https://raw.githubusercontent.com/dockur/macos/refs/heads/master/kubernetes.yml
\n

Compatibility āš™ļø

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
ProductPlatform
Docker EngineLinuxāœ…
Docker DesktopLinuxāŒ
Docker DesktopmacOSāŒ
Docker DesktopWindows 11āœ…
Docker DesktopWindows 10āŒ
\n

FAQ šŸ’¬

\n

How do I use it?

\n

Very simple! These are the steps:

\n
    \n
  • \n

    Start the container and connect to port 8006 using your web browser.

    \n
  • \n
  • \n

    Choose Disk Utility and then select the largest Apple Inc. VirtIO Block Media disk.

    \n
  • \n
  • \n

    Click the Erase button to format the disk to APFS, and give it any recognizable name you like.

    \n
  • \n
  • \n

    Close the current window and proceed the installation by clicking Reinstall macOS.

    \n
  • \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
\n

Enjoy your brand new machine, and don't forget to star this repo!

\n

How do I select the macOS version?

\n

By default, macOS 13 (Ventura) will be installed, as it offers the best performance.

\n

But you can add the VERSION environment variable to your compose file, in order to specify an alternative macOS version to be downloaded:

\n
environment:\n  VERSION: \"13\"
\n

Select from the values below:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
ValueVersionName
15macOS 15Sequoia
14macOS 14Sonoma
13macOS 13Ventura
12macOS 12Monterey
11macOS 11Big Sur
\n

How do I change the storage location?

\n

To change the storage location, include the following bind mount in your compose file:

\n
volumes:\n  - /var/osx:/storage
\n

Replace the example path /var/osx with the desired storage folder.

\n

How do I change the size of the disk?

\n

To expand the default size of 64 GB, add the DISK_SIZE setting to your compose file and set it to your preferred capacity:

\n
environment:\n  DISK_SIZE: \"256G\"
\n

Tip

This can also be used to resize the existing disk to a larger capacity without any data loss.

\n
\n

How do I change the amount of CPU or RAM?

\n

By default, the container will be allowed to use a maximum of 2 CPU cores and 4 GB of RAM.

\n

If you want to adjust this, you can specify the desired amount using the following environment variables:

\n
environment:\n  RAM_SIZE: \"8G\"\n  CPU_CORES: \"4\"
\n

How do I pass-through a USB device?

\n

To 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:

\n
environment:\n  ARGUMENTS: \"-device usb-host,vendorid=0x1234,productid=0x1234\"\ndevices:\n  - /dev/bus/usb
\n

How do I verify if my system supports KVM?

\n

Only Linux and Windows 11 support KVM virtualization, macOS and Windows 10 do not unfortunately.

\n

You can run the following commands in Linux to check your system:

\n
sudo apt install cpu-checker\nsudo kvm-ok
\n

If you receive an error from kvm-ok indicating that KVM cannot be used, please check whether:

\n
    \n
  • \n

    the virtualization extensions (Intel VT-x or AMD SVM) are enabled in your BIOS.

    \n
  • \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
\n

If you do not receive any error from kvm-ok but the container still complains about KVM, please check whether:

\n
    \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 privileged: true to your compose file (or sudo to your docker run command), to rule out any permission issue.

    \n
  • \n
\n

How do I run Windows in a container?

\n

You can use dockur/windows for that. It shares many of the same features, and even has completely automatic installation.

\n

Is this project legal?

\n

Yes, 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.

\n

However, 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.

\n

Acknowledgements šŸ™

\n

Special thanks to seitenca, this project would not exist without her invaluable work.

\n

Stars 🌟

\n

\"Stars\"

\n

Disclaimer āš–ļø

\n

Only 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
","textContent":"\nOSX (macOS) inside a Docker container.\nFeatures ✨\n\nKVM acceleration\nWeb-based viewer\nAutomatic download\n\nUsage 🐳\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\nVia Docker CLI:\ndocker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 120 dockurr/macos\nVia Kubernetes:\nkubectl apply -f https://raw.githubusercontent.com/dockur/macos/refs/heads/master/kubernetes.yml\nCompatibility āš™ļø\n\n\n\nProduct\nPlatform\n\n\n\n\n\nDocker Engine\nLinux\nāœ…\n\n\nDocker Desktop\nLinux\nāŒ\n\n\nDocker Desktop\nmacOS\nāŒ\n\n\nDocker Desktop\nWindows 11\nāœ…\n\n\nDocker Desktop\nWindows 10\nāŒ\n\n\n\nFAQ šŸ’¬\nHow do I use it?\nVery simple! These are the steps:\n\n\nStart the container and connect to port 8006 using your web browser.\n\n\nChoose Disk Utility and then select the largest Apple Inc. VirtIO Block Media disk.\n\n\nClick the Erase button to format the disk to APFS, and give it any recognizable name you like.\n\n\nClose the current window and proceed the installation by clicking Reinstall macOS.\n\n\nWhen prompted where you want to install it, select the disk you just created previously.\n\n\nAfter all files are copied, select your region, language, and account settings.\n\n\nEnjoy 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:\nenvironment:\n VERSION: \"13\"\nSelect from the values below:\n\n\n\nValue\nVersion\nName\n\n\n\n\n15\nmacOS 15\nSequoia\n\n\n14\nmacOS 14\nSonoma\n\n\n13\nmacOS 13\nVentura\n\n\n12\nmacOS 12\nMonterey\n\n\n11\nmacOS 11\nBig Sur\n\n\n\nHow 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\nReplace the example path /var/osx with the desired storage folder.\nHow 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:\nenvironment:\n DISK_SIZE: \"256G\"\nTipThis can also be used to resize the existing disk to a larger capacity without any data loss.\n\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\"\nHow 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:\nenvironment:\n ARGUMENTS: \"-device usb-host,vendorid=0x1234,productid=0x1234\"\ndevices:\n - /dev/bus/usb\nHow 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\nIf you receive an error from kvm-ok indicating that KVM cannot be used, please check whether:\n\n\nthe virtualization extensions (Intel VT-x or AMD SVM) are enabled in your BIOS.\n\n\nyou enabled \"nested virtualization\" if you are running the container inside a virtual machine.\n\n\nyou are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's.\n\n\nIf you do not receive any error from kvm-ok but the container still complains about KVM, please check whether:\n\n\nyou are not using \"Docker Desktop for Linux\" as it does not support KVM, instead make use of Docker Engine directly.\n\n\nit could help to add privileged: true to your compose file (or sudo to your docker run command), to rule out any permission issue.\n\n\nHow 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","length":5098,"excerpt":"OSX (macOS) inside a Docker container.","siteName":null}