Recently, due to development needs, I needed to test and verify the application being developed on the macOS platform. Unfortunately, I don’t have a Mac, and my budget is tight. So I considered installing a macOS virtual machine on my workstation at work to solve the urgent problem.

I had previously tried installing it through VirtualBox, but it ended in failure. Later, I read that some experts had installed macOS via Docker12, so I decided to give it a try.

1. Install Docker

Install the Docker Engine using the following command.

sudo apt update
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker

You need to ensure that KVM virtualization is enabled on the host machine and that the necessary permissions have been added. Run the following command.

sudo chmod 666 /dev/kvm

2. Download macOS image

Run the following command to pull the dockurr/macos image:

docker pull dockurr/macos

3. Docker runtime permission issues

If a ‘permission denied’ issue occurs, besides running with elevated privileges using ‘sudo’, you can add the current user to the ‘docker’ group, and it will be resolved after a restart.

# Check if the Docker user group exists
cat /etc/group | grep docker
# If it does not exist, create the Docker user group
sudo groupadd docker
# Add the current user to the Docker user group
sudo gpasswd -a $USER docker
# Update User Group
newgrp docker

4. Run a Docker container

Use the following command to start a macOS container, and you can save it as a script for convenient use.

docker run -it --rm --name macos -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN -v "${PWD:-.}/macos:/storage" --stop-timeout 120 dockurr/macos

If it is the first time running the above command or script, it will download the recovery image from the source and then proceed with the installation.

5. Access via web browser

After starting the container, open your browser and go to http://localhost:8006 to access the macOS installation interface.

2025-10-15 16-56-53.png
等待启动完成,正常安装即可。
2025-10-15 17-07-37.png