在 Docker 中以接近原生的性能运行 Mac OS X!X11 转发!iMessage 安全研究!iPhone USB 正常工作!macOS 运行在 Docker 容器中!
使用 Linux 和 Windows 在 macOS 上进行安全研究!
视频设置教程也可在此处观看:https://www.youtube.com/watch?v=wLezYl77Ll8
Windows 用户:点击此处查看以下说明!
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e SHORTNAME=catalina \
sickcodes/docker-osx:latest
# docker build -t docker-osx .
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e SHORTNAME=big-sur \
sickcodes/docker-osx:latest
# docker build -t docker-osx .
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e GENERATE_UNIQUE=true \
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \
-e SHORTNAME=monterey \
sickcodes/docker-osx:latest
# docker build -t docker-osx .
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e GENERATE_UNIQUE=true \
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \
-e SHORTNAME=ventura \
sickcodes/docker-osx:latest
# docker build -t docker-osx .
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e GENERATE_UNIQUE=true \
-e CPU='Haswell-noTSX' \
-e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' \
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' \
-e SHORTNAME=sonoma \
sickcodes/docker-osx:latest
# docker build -t docker-osx .
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e GENERATE_UNIQUE=true \
-e CPU='Haswell-noTSX' \
-e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' \
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' \
-e SHORTNAME=sequoia \
sickcodes/docker-osx:latest
# docker build -t docker-osx .
最简单、最安全的方法是 sshfs
# on Linux/Windows
mkdir ~/mnt/osx
sshfs user@localhost: -p 50922 ~/mnt/osx
# wait a few seconds, and ~/mnt/osx will have full rootfs mounted over ssh, and in userspace
# automated: sshpass -p <password> sshfs user@localhost:/ -p 50922 ~/mnt/osx
localhost:50922
)localhost:8888
)docker commit
克隆您的容器:auto
至少需要 50GB 空间(一半用于基础镜像,一半用于运行时镜像)在执行任何其他操作之前,您需要在 BIOS 中启用硬件虚拟化。具体操作取决于您的具体机器(和 BIOS),但应该很简单。
然后,您需要在主机上安装 QEMU 和其他一些依赖项:
# ARCH
sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison iptables-nft edk2-ovmf
# UBUNTU DEBIAN
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager libguestfs-tools
# CENTOS RHEL FEDORA
sudo yum install libvirt qemu-kvm
Then, enable libvirt and load the KVM kernel module:
sudo systemctl enable --now libvirtd
sudo systemctl enable --now virtlogd
echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs
sudo modprobe kvm
使用 WSL2(Windows 11 + Windows Subsystem for Linux)可以在 Windows 上运行 Docker-OSX。
您必须安装 Windows 11 版本 22000+(21H2 或更高版本)。
首先,在您的计算机上安装 WSL,方法是在管理员权限的 PowerShell 中运行此命令。更多信息,请访问此处。
这将默认安装 Ubuntu。
wsl --install
您可以使用 PowerShell 中的“wsl -l -v”来确认 WSL2 已启用。要查看其他可用的发行版,请使用“wsl -l -o”。
如果您之前安装了 WSL1,请升级到 WSL 2。请查看此链接,了解如何从 WSL1 升级到 WSL2。
安装 WSL 后,转到“C:/Users/<Your_Name>/.wslconfig”,并在文件末尾添加“nestedVirtualization=true”(如果该文件不存在,请创建)。有关“.wslconfig”文件的更多信息,请查看此链接。请确保您在文件资源管理器选项中已选中“显示隐藏文件”和“显示文件扩展名”。结果应该是这样的:
[wsl2]
nestedVirtualization=true
进入你的 WSL 发行版(在 powershell 中运行 wsl
),并使用 kvm-ok
命令检查 KVM 是否已启用。输出应如下所示:
INFO: /dev/kvm exists
KVM acceleration can be used
如果尚未安装,请使用命令“sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm”进行安装。
现在,如果尚未安装 Docker for Windows,请下载并安装。
安装完成后,进入“设置”并勾选以下两个框:
常规 -> “使用基于 WSL2 的引擎”;
资源 -> WSL 集成 -> “启用与我的默认 WSL 发行版的集成”
确保已安装“x11-apps”。如果尚未安装,请使用命令“sudo apt install x11-apps -y”进行安装。
最后,有三种获取视频输出的方法:
要使用 WSLg 内置的 X-11 服务器,请将 docker run 命令中的这两行更改为将 Docker-OSX 指向 WSLg。
-e "DISPLAY=${DISPLAY:-:0.0}" \
-v /mnt/wslg/.X11-unix:/tmp/.X11-unix \
或者尝试:
-e "DISPLAY=${DISPLAY:-:0}" \
-v /mnt/wslg/.X11-unix:/tmp/.X11-unix \
对于 Windows 上的 Ubuntu 20.x,请参阅 https://github.com/sickcodes/Docker-OSX/discussions/458