
https://github.com/dockur/macos/ https://hub.docker.com/r/dockurr/macos/tags https://hub.docker.com/r/dockurr/macos/tags https://github.com/dockur/macos/pkgs/container/macos https://hub.docker.com/r/dockurr/macos/
MacOS inside a Docker container.
Via Docker Compose:
yamlservices: macos: image: dockurr/macos container_name: macos environment: VERSION: "14" devices: - /dev/kvm - /dev/net/tun cap_add: - NET_ADMIN ports: - 8006:8006 - 5900:5900/tcp - 5900:5900/udp volumes: - ./macos:/storage restart: always stop_grace_period: 2m
Via Docker CLI:
bashdocker run -it --rm --name macos -e "VERSION=14" -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v "${PWD:-.}/macos:/storage" --stop-timeout 120 docker.io/dockurr/macos
Via Kubernetes:
shellkubectl apply -f https://raw.githubusercontent.com/dockur/macos/refs/heads/master/kubernetes.yml
Via Github Codespaces:
https://github.com/codespaces/badge.svg]([***]
Very simple! These are the steps:
Start the container and connect to port 8006 using your web browser.
Choose Disk Utility and then select the largest Apple Inc. VirtIO Block Media disk.
Click the Erase button to format the disk to APFS, and give it any name you like.
Close the current window and proceed the installation by clicking Reinstall macOS.
When prompted where you want to install it, select the disk you created previously.
After all files are copied, select your region, language, and keyboard settings.
When the Migration Assistant wants to transfer data, select Not now (bottom left).
On the Apple ID screen, select Set Up Later (bottom left) and then proceed using Skip.
On the Create a Computer Account screen, fill in a username and password and Continue.
Enjoy your brand new machine, and don't forget to star this repo!
By default, macOS 14 (Sonoma) will be installed, but you can add the VERSION environment variable in order to specify an alternative:
yamlenvironment: VERSION: "15"
Select from the values below:
| Value | Version | Name |
|---|---|---|
15 | macOS 15 | Sequoia |
14 | macOS 14 | Sonoma |
13 | macOS 13 | Ventura |
12 | macOS 12 | Monterey |
11 | macOS 11 | Big Sur |
[!NOTE] Support for macOS 15 (Sequoia) is still in its infancy, as it does not allow you to sign in to your Apple Account yet.
To change the storage location, include the following bind mount in your compose file:
yamlvolumes: - ./macos:/storage
Replace the example path ./macos with the desired storage folder or named volume.
To expand the default size of 64 GB, add the DISK_SIZE setting to your compose file and set it to your preferred capacity:
yamlenvironment: DISK_SIZE: "256G"
[!TIP] This can also be used to resize the existing disk to a larger capacity without any data loss.
By default, macOS will be allowed to use a single CPU core and 4 GB of RAM.
If you want to adjust this, you can specify the desired amount using the following environment variables:
yamlenvironment: RAM_SIZE: "8G" CPU_CORES: "4"
[!IMPORTANT]
If your system has an AMD processor (instead of Intel), it is not advisable to enable multiple cores before the installation is completed and you have verified that everything runs stable for a while. Because in many cases it will introduce issues, which are difficult to pinpoint if you do not have experience with its behavior on a single core first.
By default, the container uses bridge networking, which shares the IP address with the host.
If you want to assign an individual IP address to the container, you can create a macvlan network as follows:
bashdocker network create -d macvlan \ --subnet=192.168.0.0/24 \ --gateway=192.168.0.1 \ --ip-range=192.168.0.100/28 \ -o parent=eth0 vlan
Be sure to modify these values to match your local subnet.
Once you have created the network, change your compose file to look as follows:
yamlservices: macos: container_name: macos ..<snip>.. networks: vlan: ipv4_address: 192.168.0.100 networks: vlan: external: true
An added benefit of this approach is that you won't have to perform any port mapping anymore, since all ports will be exposed by default.
[!IMPORTANT]
This IP address won't be accessible from the Docker host due to the design of macvlan, which doesn't permit communication between the two. If this is a concern, you need to create a second macvlan as a workaround.
After configuring the container for macvlan, it is possible for macOS to become part of your home network by requesting an IP from your router, just like your other devices.
To enable this mode, in which the container and macOS will have separate IP addresses, add the following lines to your compose file:
yamlenvironment: DHCP: "Y" devices: - /dev/vhost-net device_cgroup_rules: - 'c *:* rwm'
It is possible to pass-through disk devices or partitions directly by adding them to your compose file in this way:
yamldevices: - /dev/sdb:/disk1 - /dev/sdc1:/disk2
Use /disk1 if you want it to become your main drive, and use /disk2 and higher to add them as secondary drives.
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:
yamlenvironment: ARGUMENTS: "-device usb-host,vendorid=0x1234,productid=0x1234" devices: - /dev/bus/usb
To share files with the host, add the following volume to your compose file:
yamlvolumes: - ./example:/shared
Then start macOS and execute the following command:
shellsudo -S mount_9p shared
In Finder’s menu bar, click on “Go – Computer” to access this shared folder, it will show the contents of ./example.
First check if your software is compatible using this chart:
| Product | Linux | Win11 | Win10 | macOS |
|---|---|---|---|---|
| Docker CLI | ✅ | ✅ | ❌ | ❌ |
| Docker Desktop | ❌ | ✅ | ❌ | ❌ |
| Podman CLI | ✅ | ✅ | ❌ | ❌ |
| Podman Desktop | ✅ | ✅ | ❌ | ❌ |
After that you can run the following commands in Linux to check your system:
bashsudo apt install cpu-checker sudo kvm-ok
If you receive an error from kvm-ok indicating that KVM cannot be used, please check whether:
the virtualization extensions (Intel VT-x or AMD SVM) are enabled in your BIOS.
you enabled "nested virtualization" if you are running the container inside a virtual machine.
you are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's.
If you did not receive any error from kvm-ok but the container still complains about a missing KVM device, it could help to add privileged: true to your compose file (or sudo to your docker command) to rule out any permission issue.
You can use https://github.com/dockur/windows for that. It shares many of the same features, and even has completely automatic installation.
You can use https://github.com/qemus/qemu in that case.
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 ***ed legal.
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.
Special thanks to https://github.com/seitenca, this project would not exist without her invaluable work.






探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务