You've already forked Docker-OSX
mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2025-07-02 18:53:31 -05:00
Compare commits
15 Commits
shrink-nak
...
rollback-n
Author | SHA1 | Date | |
---|---|---|---|
e718aec193 | |||
0202359871 | |||
a04466a704 | |||
21b17535b5 | |||
e79ce8a273 | |||
d028bd341b | |||
c6c6c69851 | |||
be0c44928f | |||
8ae71a36d1 | |||
030258ef67 | |||
7300479b9a | |||
8dc03683e1 | |||
55b4820e07 | |||
d2e2604cfc | |||
3f7256e145 |
22
CREDITS.md
22
CREDITS.md
@ -1,5 +1,7 @@
|
||||
# Credits
|
||||
|
||||
The most important part of the project. You.
|
||||
|
||||
## Upstream Acknowledgements:
|
||||
|
||||
This project uses OSX-KVM from https://github.com/kholia/OSX-KVM and fully appreciates the work done by [@Kholia](https://github.com/Kholia) and all the contributors who are listed: [https://github.com/kholia/OSX-KVM/blob/master/CREDITS.md](https://github.com/kholia/OSX-KVM/blob/master/CREDITS.md)
|
||||
@ -10,7 +12,7 @@ We use a special fork by [Nicholas Sherlock](https://www.nicksherlock.com/) of K
|
||||
|
||||
This project now uses the fantastic OpenCore bootloader from the community OpenCore project: https://github.com/acidanthera/OpenCorePkg. You can join their [Subreddit here](https://www.reddit.com/r/hackintosh/)!
|
||||
|
||||
## These credits refer to the contributors to this repository:
|
||||
## These credits refer to the legendary contributors to this repository:
|
||||
|
||||
[@GreeFine](https://github.com/GreeFine) - Readme Typo #9
|
||||
|
||||
@ -72,8 +74,12 @@ This project now uses the fantastic OpenCore bootloader from the community OpenC
|
||||
|
||||
[@ggjulio](https://github.com/ggjulio) - Restarting an "auto" container #216
|
||||
|
||||
[@panos](https://github.com/panos) - Improved README #212
|
||||
|
||||
[@panos](https://github.com/panos) - Made further improvements to the README #219
|
||||
|
||||
[@kaoudis](https://github.com/kaoudis) README / troubleshooting docs improvements #235
|
||||
|
||||
[@a10kiloham](https://github.com/a10kiloham) - Dockerfile for :naked image with VNC support #245
|
||||
|
||||
[@a10kiloham](https://github.com/a10kiloham) - Adding Bluebubbles as an example use case #250
|
||||
@ -82,7 +88,7 @@ This project now uses the fantastic OpenCore bootloader from the community OpenC
|
||||
|
||||
[@tinjaw](https://github.com/tinjaw) - Fixed Type #258
|
||||
|
||||
[@m-zheng](https://github.com/m-zheng) - Update README.md #260
|
||||
[@m-zheng](https://github.com/m-zheng) - Update README.md #260
|
||||
|
||||
[@johnjhacking](https://github.com/johnjhacking) - Change call function to Popen #288
|
||||
|
||||
@ -94,6 +100,16 @@ This project now uses the fantastic OpenCore bootloader from the community OpenC
|
||||
|
||||
[@Silfalion](https://github.com/Silfalion) - [https://github.com/Silfalion/Iphone_docker_osx_passthrough](https://github.com/Silfalion/Iphone_docker_osx_passthrough)
|
||||
|
||||
[@chirag350](https://github.com/chirag350) use LABEL instead of MAINTAINER since MAINTAINER is deprecated #352
|
||||
|
||||
[@Buthrakaur](https://github.com/Buthrakaur) readme - improve instructions for running on windows #361
|
||||
|
||||
[@eggplants](https://github.com/eggplants) Fix command to launch sickcodes/docker-osx:auto #366
|
||||
[@TheHackerCoding](https://github.com/TheHackerCoding) Typo in README #367
|
||||
|
||||
[@cameronsteele](https://github.com/cameronsteele) fix Big Sur build example #378
|
||||
|
||||
[@eggplants](https://github.com/eggplants) Fix command to launch sickcodes/docker-osx:auto #366
|
||||
|
||||
[@martinmullins](https://github.com/martinmullins) Notes for mounting an NFS folder from a linux host #392
|
||||
|
||||
[@kimjammer](https://github.com/kimjammer) Readme - Added instructions for using WSLg's built in X11 server #395
|
||||
|
10
Dockerfile
10
Dockerfile
@ -61,6 +61,8 @@ ARG SIZE=200G
|
||||
|
||||
# OPTIONAL: Arch Linux server mirrors for super fast builds
|
||||
# set RANKMIRRORS to any value other that nothing, e.g. -e RANKMIRRORS=true
|
||||
|
||||
RUN perl -i -p -e s/^\#Color/Color$'\n'ParallelDownloads\ =\ 30/g /etc/pacman.conf
|
||||
ARG RANKMIRRORS
|
||||
ARG MIRROR_COUNTRY=US
|
||||
ARG MIRROR_COUNT=10
|
||||
@ -173,7 +175,7 @@ RUN touch Launch.sh \
|
||||
&& tee -a Launch.sh <<< '[[ "${RAM}" = max ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 1000000"))"' \
|
||||
&& tee -a Launch.sh <<< '[[ "${RAM}" = half ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 2000000"))"' \
|
||||
&& tee -a Launch.sh <<< 'sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true' \
|
||||
&& tee -a Launch.sh <<< 'exec qemu-system-x86_64 -m ${RAM:-2}000 \' \
|
||||
&& tee -a Launch.sh <<< 'exec qemu-system-x86_64 -m ${RAM:-4}000 \' \
|
||||
&& tee -a Launch.sh <<< '-cpu ${CPU:-Penryn},${CPUID_FLAGS:-vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check,}${BOOT_ARGS} \' \
|
||||
&& tee -a Launch.sh <<< '-machine q35,${KVM-"accel=kvm:tcg"} \' \
|
||||
&& tee -a Launch.sh <<< '-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4}} \' \
|
||||
@ -187,7 +189,7 @@ RUN touch Launch.sh \
|
||||
&& tee -a Launch.sh <<< '-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=${BOOTDISK:-/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2} \' \
|
||||
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.2,drive=OpenCoreBoot \' \
|
||||
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.3,drive=InstallMedia \' \
|
||||
&& tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=${BASESYSTEM_FORMAT} \' \
|
||||
&& tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=${BASESYSTEM_FORMAT:-qcow2} \' \
|
||||
&& tee -a Launch.sh <<< '-drive id=MacHDD,if=none,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=${IMAGE_FORMAT:-qcow2} \' \
|
||||
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.4,drive=MacHDD \' \
|
||||
&& tee -a Launch.sh <<< '-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900,${ADDITIONAL_PORTS} \' \
|
||||
@ -321,7 +323,7 @@ ENV IMAGE_FORMAT=qcow2
|
||||
|
||||
ENV KVM='accel=kvm:tcg'
|
||||
|
||||
ENV MASTER_PLIST_URL="https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist"
|
||||
ENV MASTER_PLIST_URL="https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist"
|
||||
|
||||
# ENV NETWORKING=e1000-82545em
|
||||
ENV NETWORKING=vmxnet3
|
||||
@ -330,7 +332,7 @@ ENV NETWORKING=vmxnet3
|
||||
ENV NOPICKER=false
|
||||
|
||||
# dynamic RAM options for runtime
|
||||
ENV RAM=3
|
||||
ENV RAM=4
|
||||
# ENV RAM=max
|
||||
# ENV RAM=half
|
||||
|
||||
|
238
Dockerfile.naked
238
Dockerfile.naked
@ -30,22 +30,22 @@
|
||||
# docker run -it --device /dev/kvm -p 50922:10022 -v ${PWD}/mac_hdd_ng.img:/image -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix docker-osx:naked
|
||||
#
|
||||
|
||||
FROM archlinux:base-devel
|
||||
LABEL maintainer='https://twitter.com/sickcodes <https://sick.codes>'
|
||||
FROM sickcodes/docker-osx:latest
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
MAINTAINER 'https://twitter.com/sickcodes' <https://sick.codes>
|
||||
|
||||
# change disk size here or add during build, e.g. --build-arg VERSION=10.14.5 --build-arg SIZE=50G
|
||||
ARG SIZE=200G
|
||||
USER root
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
RUN rm -f /home/arch/OSX-KVM/mac_hdd_ng.img
|
||||
|
||||
# OPTIONAL: Arch Linux server mirrors for super fast builds
|
||||
# set RANKMIRRORS to any value other that nothing, e.g. -e RANKMIRRORS=true
|
||||
ARG RANKMIRRORS
|
||||
ARG MIRROR_COUNTRY=US
|
||||
ARG MIRROR_COUNT=10
|
||||
|
||||
RUN if [[ "${RANKMIRRORS}" ]]; then \
|
||||
{ pacman -Sy wget --noconfirm || pacman -Syu wget --noconfirm ; } \
|
||||
RUN if [[ "${RANKMIRRORS}" ]]; then { pacman -Sy wget --noconfirm || pacman -Syu wget --noconfirm ; } \
|
||||
; wget -O ./rankmirrors "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/rankmirrors" \
|
||||
; wget -O- "https://www.archlinux.org/mirrorlist/?country=${MIRROR_COUNTRY:-US}&protocol=https&use_mirror_status=on" \
|
||||
| sed -e 's/^#Server/Server/' -e '/^#/d' \
|
||||
@ -57,40 +57,11 @@ RUN if [[ "${RANKMIRRORS}" ]]; then \
|
||||
&& cat /etc/pacman.d/mirrorlist \
|
||||
; fi
|
||||
|
||||
# This fails on hub.docker.com, useful for debugging in cloud
|
||||
# RUN [[ $(egrep -c '(svm|vmx)' /proc/cpuinfo) -gt 0 ]] || { echo KVM not possible on this host && exit 1; }
|
||||
|
||||
# RUN tee -a /etc/pacman.conf <<< '[community-testing]' \
|
||||
# && tee -a /etc/pacman.conf <<< 'Include = /etc/pacman.d/mirrorlist'
|
||||
|
||||
RUN pacman -Syu git zip vim nano alsa-utils openssh --noconfirm \
|
||||
&& ln -s /bin/vim /bin/vi \
|
||||
&& useradd arch -p arch \
|
||||
&& tee -a /etc/sudoers <<< 'arch ALL=(ALL) NOPASSWD: ALL' \
|
||||
&& mkdir /home/arch \
|
||||
&& chown arch:arch /home/arch \
|
||||
&& yes | sudo pacman -Scc
|
||||
|
||||
# allow ssh to container
|
||||
RUN mkdir -m 700 /root/.ssh \
|
||||
&& touch /root/.ssh/authorized_keys \
|
||||
&& chmod 644 /root/.ssh/authorized_keys \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'AllowTcpForwarding yes' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'PermitTunnel yes' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'X11Forwarding yes' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'PasswordAuthentication yes' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'PermitRootLogin yes' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'PubkeyAuthentication yes' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'HostKey /etc/ssh/ssh_host_rsa_key' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'HostKey /etc/ssh/ssh_host_ecdsa_key' \
|
||||
&& tee -a /etc/ssh/sshd_config <<< 'HostKey /etc/ssh/ssh_host_ed25519_key'
|
||||
|
||||
# For taking screenshots of the Xfvb screen, useful during development.
|
||||
ARG SCROT
|
||||
|
||||
# the following code only runs if --build-arg SCROT=true is used
|
||||
RUN pacman -Syu xorg-server-xvfb wget xterm xorg-xhost xorg-xrandr sshpass --noconfirm \
|
||||
&& if [[ "${SCROT}" == true ]]; then \
|
||||
&& if [[ "${SCROT}" ]]; then \
|
||||
pacman -Syu scrot base-devel --noconfirm \
|
||||
&& git clone --recurse-submodules --depth 1 https://github.com/stolk/imcat.git \
|
||||
&& cd imcat \
|
||||
@ -110,102 +81,6 @@ USER arch
|
||||
|
||||
ENV USER arch
|
||||
|
||||
# download OSX-KVM
|
||||
# RUN git clone --recurse-submodules --depth 1 https://github.com/kholia/OSX-KVM.git /home/arch/OSX-KVM
|
||||
RUN git clone --recurse-submodules --depth 1 https://github.com/kholia/OSX-KVM.git /home/arch/OSX-KVM
|
||||
|
||||
WORKDIR /home/arch/OSX-KVM
|
||||
|
||||
RUN touch enable-ssh.sh \
|
||||
&& chmod +x ./enable-ssh.sh \
|
||||
&& tee -a enable-ssh.sh <<< '[[ -f /etc/ssh/ssh_host_rsa_key ]] || \' \
|
||||
&& tee -a enable-ssh.sh <<< '[[ -f /etc/ssh/ssh_host_ed25519_key ]] || \' \
|
||||
&& tee -a enable-ssh.sh <<< '[[ -f /etc/ssh/ssh_host_ed25519_key ]] || \' \
|
||||
&& tee -a enable-ssh.sh <<< 'sudo /usr/bin/ssh-keygen -A' \
|
||||
&& tee -a enable-ssh.sh <<< 'nohup sudo /usr/bin/sshd -D &'
|
||||
|
||||
# QEMU CONFIGURATOR
|
||||
# set optional ram at runtime -e RAM=16
|
||||
# set optional cores at runtime -e SMP=4 -e CORES=2
|
||||
# add any additional commands in QEMU cli format -e EXTRA="-usb -device usb-host,hostbus=1,hostaddr=8"
|
||||
|
||||
# default env vars, RUNTIME ONLY, not for editing in build time.
|
||||
|
||||
# RUN yes | sudo pacman -Syu qemu libvirt dnsmasq virt-manager bridge-utils edk2-ovmf netctl libvirt-dbus --overwrite --noconfirm
|
||||
|
||||
RUN yes | sudo pacman -Syu bc qemu libvirt dnsmasq virt-manager bridge-utils openresolv jack ebtables edk2-ovmf netctl libvirt-dbus wget --overwrite --noconfirm \
|
||||
&& yes | sudo pacman -Scc
|
||||
|
||||
WORKDIR /home/arch/OSX-KVM
|
||||
|
||||
# we still want a recovery disk, monterey is backwards compatible (APFS), however, the Catalina and below are not (HFS+).
|
||||
ARG SHORTNAME=monterey
|
||||
|
||||
RUN make \
|
||||
&& qemu-img convert BaseSystem.dmg -O qcow2 -p -c BaseSystem.img \
|
||||
&& rm ./BaseSystem.dmg
|
||||
|
||||
ARG LINUX=true
|
||||
|
||||
# required to use libguestfs inside a docker container, to create bootdisks for docker-osx on-the-fly
|
||||
RUN if [[ "${LINUX}" == true ]]; then \
|
||||
sudo pacman -Syu linux libguestfs --noconfirm \
|
||||
&& yes | sudo pacman -Scc \
|
||||
; fi
|
||||
|
||||
# optional --build-arg to change branches for testing
|
||||
ARG BRANCH=master
|
||||
ARG REPO='https://github.com/sickcodes/Docker-OSX.git'
|
||||
# RUN git clone --recurse-submodules --depth 1 --branch "${BRANCH}" "${REPO}"
|
||||
RUN git clone --recurse-submodules --depth 1 --branch "${BRANCH}" "${REPO}"
|
||||
|
||||
RUN touch Launch.sh \
|
||||
&& chmod +x ./Launch.sh \
|
||||
&& tee -a Launch.sh <<< '#!/bin/bash' \
|
||||
&& tee -a Launch.sh <<< 'set -eux' \
|
||||
&& tee -a Launch.sh <<< 'sudo chown $(id -u):$(id -g) /dev/kvm 2>/dev/null || true' \
|
||||
&& tee -a Launch.sh <<< 'sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true' \
|
||||
&& tee -a Launch.sh <<< '[[ "${RAM}" = max ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 1000000"))"' \
|
||||
&& tee -a Launch.sh <<< '[[ "${RAM}" = half ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 2000000"))"' \
|
||||
&& tee -a Launch.sh <<< 'sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true' \
|
||||
&& tee -a Launch.sh <<< 'exec qemu-system-x86_64 -m ${RAM:-2}000 \' \
|
||||
&& tee -a Launch.sh <<< '-cpu ${CPU:-Penryn},${CPUID_FLAGS:-vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check,}${BOOT_ARGS} \' \
|
||||
&& tee -a Launch.sh <<< '-machine q35,${KVM-"accel=kvm:tcg"} \' \
|
||||
&& tee -a Launch.sh <<< '-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4}} \' \
|
||||
&& tee -a Launch.sh <<< '-usb -device usb-kbd -device usb-tablet \' \
|
||||
&& tee -a Launch.sh <<< '-device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \' \
|
||||
&& tee -a Launch.sh <<< '-drive if=pflash,format=raw,readonly=on,file=/home/arch/OSX-KVM/OVMF_CODE.fd \' \
|
||||
&& tee -a Launch.sh <<< '-drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd \' \
|
||||
&& tee -a Launch.sh <<< '-smbios type=2 \' \
|
||||
&& tee -a Launch.sh <<< '-audiodev ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \' \
|
||||
&& tee -a Launch.sh <<< '-device ich9-ahci,id=sata \' \
|
||||
&& tee -a Launch.sh <<< '-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=${BOOTDISK:-/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2} \' \
|
||||
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.2,drive=OpenCoreBoot \' \
|
||||
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.3,drive=InstallMedia \' \
|
||||
&& tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=${BASESYSTEM_FORMAT} \' \
|
||||
&& tee -a Launch.sh <<< '-drive id=MacHDD,if=none,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=${IMAGE_FORMAT:-qcow2} \' \
|
||||
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.4,drive=MacHDD \' \
|
||||
&& tee -a Launch.sh <<< '-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900,${ADDITIONAL_PORTS} \' \
|
||||
&& tee -a Launch.sh <<< '-device ${NETWORKING:-vmxnet3},netdev=net0,id=net0,mac=${MAC_ADDRESS:-52:54:00:09:49:17} \' \
|
||||
&& tee -a Launch.sh <<< '-monitor stdio \' \
|
||||
&& tee -a Launch.sh <<< '-boot menu=on \' \
|
||||
&& tee -a Launch.sh <<< '-vga vmware \' \
|
||||
&& tee -a Launch.sh <<< '${EXTRA:-}'
|
||||
|
||||
# docker exec containerid mv ./Launch-nopicker.sh ./Launch.sh
|
||||
# This is now a legacy command.
|
||||
# You can use -e BOOTDISK=/bootdisk with -v ./bootdisk.img:/bootdisk
|
||||
|
||||
### LEGACY CODE
|
||||
RUN grep -v InstallMedia ./Launch.sh > ./Launch-nopicker.sh \
|
||||
&& chmod +x ./Launch-nopicker.sh \
|
||||
&& sed -i -e s/OpenCore\.qcow2/OpenCore\-nopicker\.qcow2/ ./Launch-nopicker.sh
|
||||
###
|
||||
|
||||
USER arch
|
||||
|
||||
ENV USER arch
|
||||
|
||||
#### libguestfs versioning
|
||||
|
||||
# 5.13+ problem resolved by building the qcow2 against 5.12 using libguestfs-1.44.1-6
|
||||
@ -217,66 +92,16 @@ ENV KERNEL_PACKAGE_URL=https://archive.archlinux.org/packages/l/linux/linux-5.12
|
||||
ENV KERNEL_HEADERS_PACKAGE_URL=https://archive.archlinux.org/packages/l/linux/linux-headers-5.12.14.arch1-1-x86_64.pkg.tar.zst
|
||||
ENV LIBGUESTFS_PACKAGE_URL=https://archive.archlinux.org/packages/l/libguestfs/libguestfs-1.44.1-6-x86_64.pkg.tar.zst
|
||||
|
||||
# fix ad hoc errors from using the arch museum to get libguestfs
|
||||
RUN sudo sed -i -e 's/^\#RemoteFileSigLevel/RemoteFileSigLevel/g' /etc/pacman.conf
|
||||
|
||||
RUN sudo pacman -Syy \
|
||||
&& sudo pacman -Rns linux --noconfirm \
|
||||
; sudo pacman -S mkinitcpio --noconfirm \
|
||||
&& sudo pacman -U "${KERNEL_PACKAGE_URL}" --noconfirm || exit 1 \
|
||||
&& sudo pacman -U "${LIBGUESTFS_PACKAGE_URL}" --noconfirm || exit 1 \
|
||||
&& sudo pacman -U "${KERNEL_PACKAGE_URL}" --noconfirm \
|
||||
&& sudo pacman -U "${LIBGUESTFS_PACKAGE_URL}" --noconfirm \
|
||||
&& rm -rf /var/tmp/.guestfs-* \
|
||||
&& yes | sudo pacman -Scc \
|
||||
&& libguestfs-test-tool || exit 1 \
|
||||
&& rm -rf /var/tmp/.guestfs-*
|
||||
; libguestfs-test-tool || exit 1
|
||||
|
||||
####
|
||||
|
||||
# These are hardcoded serials for non-iMessage related research
|
||||
# Overwritten by using GENERATE_UNIQUE=true
|
||||
# Upstream removed nopicker, so we are adding it back in, at build time
|
||||
# Once again, this is just for the Docker build so there is a default nopicker image there
|
||||
|
||||
# libguestfs verbose
|
||||
ENV LIBGUESTFS_DEBUG=1
|
||||
ENV LIBGUESTFS_TRACE=1
|
||||
|
||||
ARG STOCK_DEVICE_MODEL=iMacPro1,1
|
||||
ARG STOCK_SERIAL=C02TM2ZBHX87
|
||||
ARG STOCK_BOARD_SERIAL=C02717306J9JG361M
|
||||
ARG STOCK_UUID=007076A6-F2A2-4461-BBE5-BAD019F8025A
|
||||
ARG STOCK_MAC_ADDRESS=00:0A:27:00:00:00
|
||||
ARG STOCK_WIDTH=1920
|
||||
ARG STOCK_HEIGHT=1080
|
||||
ARG STOCK_MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist
|
||||
ARG STOCK_MASTER_PLIST_URL_NOPICKER=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist
|
||||
ARG STOCK_BOOTDISK=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2
|
||||
ARG STOCK_BOOTDISK_NOPICKER=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2
|
||||
|
||||
RUN ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \
|
||||
--master-plist-url="${STOCK_MASTER_PLIST_URL}" \
|
||||
--model "${STOCK_DEVICE_MODEL}" \
|
||||
--serial "${STOCK_SERIAL}" \
|
||||
--board-serial "${STOCK_BOARD_SERIAL}" \
|
||||
--uuid "${STOCK_UUID}" \
|
||||
--mac-address "${STOCK_MAC_ADDRESS}" \
|
||||
--width "${STOCK_WIDTH}" \
|
||||
--height "${STOCK_HEIGHT}" \
|
||||
--output-bootdisk "${STOCK_BOOTDISK}" || exit 1 \
|
||||
; rm -rf /var/tmp/.guestfs-*
|
||||
|
||||
RUN ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \
|
||||
--master-plist-url="${STOCK_MASTER_PLIST_URL_NOPICKER}" \
|
||||
--model "${STOCK_DEVICE_MODEL}" \
|
||||
--serial "${STOCK_SERIAL}" \
|
||||
--board-serial "${STOCK_BOARD_SERIAL}" \
|
||||
--uuid "${STOCK_UUID}" \
|
||||
--mac-address "${STOCK_MAC_ADDRESS}" \
|
||||
--width "${STOCK_WIDTH}" \
|
||||
--height "${STOCK_HEIGHT}" \
|
||||
--output-bootdisk "${STOCK_BOOTDISK_NOPICKER}" || exit 1 \
|
||||
; rm -rf /var/tmp/.guestfs-*
|
||||
|
||||
|
||||
WORKDIR /home/arch/OSX-KVM
|
||||
|
||||
@ -290,13 +115,15 @@ RUN mkdir -p ~/.ssh \
|
||||
&& tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \
|
||||
&& tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null'
|
||||
|
||||
### symlink the old directory as upstream has renamed a directory. Symlinking purely for backwards compatability!
|
||||
####
|
||||
|
||||
# symlink the old directory, for redundancy
|
||||
RUN ln -s /home/arch/OSX-KVM/OpenCore /home/arch/OSX-KVM/OpenCore-Catalina || true
|
||||
|
||||
####
|
||||
|
||||
#### SPECIAL RUNTIME ARGUMENTS BELOW
|
||||
# env -e ADDITIONAL_PORTS with a comma
|
||||
# for example, -e ADDITIONAL_PORTS=hostfwd=tcp::23-:23,
|
||||
|
||||
ENV ADDITIONAL_PORTS=
|
||||
|
||||
# add additional QEMU boot arguments
|
||||
@ -304,13 +131,13 @@ ENV BOOT_ARGS=
|
||||
|
||||
ENV BOOTDISK=
|
||||
|
||||
# edit the CPU that is being emulated
|
||||
# edit the CPU that is beign emulated
|
||||
ENV CPU=Penryn
|
||||
ENV CPUID_FLAGS='vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check,'
|
||||
|
||||
ENV DISPLAY=:0.0
|
||||
ENV DISPLAY=:99
|
||||
|
||||
ENV HEADLESS=false
|
||||
|
||||
# Deprecated
|
||||
ENV ENV=/env
|
||||
|
||||
# Boolean for generating a bootdisk with new random serials.
|
||||
@ -341,26 +168,9 @@ ENV RAM=3
|
||||
ENV WIDTH=1920
|
||||
ENV HEIGHT=1080
|
||||
|
||||
VOLUME ["/tmp/.X11-unix"]
|
||||
|
||||
# check if /image is a disk image or a directory. This allows you to optionally use -v disk.img:/image
|
||||
# NOPICKER is used to skip the disk selection screen
|
||||
# GENERATE_UNIQUE is used to generate serial numbers on boot.
|
||||
# /env is a file that you can generate and save using -v source.sh:/env
|
||||
# the env file is a file that you can carry to the next container which will supply the serials numbers.
|
||||
# GENERATE_SPECIFIC is used to either accept the env serial numbers OR you can supply using:
|
||||
# -e DEVICE_MODEL="iMacPro1,1" \
|
||||
# -e SERIAL="C02TW0WAHX87" \
|
||||
# -e BOARD_SERIAL="C027251024NJG36UE" \
|
||||
# -e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \
|
||||
# -e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \
|
||||
|
||||
# the output will be /bootdisk.
|
||||
# /bootdisk is a useful persistent place to store the 15Mb serial number bootdisk.
|
||||
|
||||
# if you don't set any of the above:
|
||||
# the default serial numbers are already contained in ./OpenCore/OpenCore.qcow2
|
||||
# And the default serial numbers
|
||||
# libguestfs verbose
|
||||
ENV LIBGUESTFS_DEBUG=1
|
||||
ENV LIBGUESTFS_TRACE=1
|
||||
|
||||
CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \
|
||||
; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \
|
||||
|
72
README.md
72
README.md
@ -4,6 +4,8 @@
|
||||
|
||||
Run Mac OS X in Docker with near-native performance! X11 Forwarding! iMessage security research! iPhone USB working! macOS in a Docker container!
|
||||
|
||||
Conduct Security Research on macOS using both Linux & Windows!
|
||||
|
||||
# Docker-OSX now has a Discord server & Telegram!
|
||||
|
||||
The Discord is active on #docker-osx and anyone is welcome to come and ask questions, ideas, etc.
|
||||
@ -13,8 +15,6 @@ The Discord is active on #docker-osx and anyone is welcome to come and ask quest
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
### Click to join the Discord server [https://discord.gg/sickchat](https://discord.gg/sickchat)
|
||||
|
||||
### Click to join the Telegram server [https://t.me/sickcodeschat](https://t.me/sickcodeschat)
|
||||
@ -43,6 +43,8 @@ If you like this project, consider contributing here or upstream!
|
||||
|
||||
Video setup tutorial is also available here: https://www.youtube.com/watch?v=wLezYl77Ll8
|
||||
|
||||
**Windows users:** [click here to see the notes below](#id-like-to-run-docker-osx-on-windows)!
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.youtube.com/watch?v=wLezYl77Ll8" target="_blank"><img src="https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/Youtube-Screenshot-Docker-OSX-Setup.png"></a>
|
||||
</p>
|
||||
@ -475,6 +477,30 @@ echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs
|
||||
sudo modprobe kvm
|
||||
```
|
||||
|
||||
### I'd like to run Docker-OSX on Windows
|
||||
|
||||
Running Docker-OSX on Windows is now possible using WSL2 (Windows + Ubuntu Subsystem!).
|
||||
|
||||
Ensure KVM is enabled (Windows 11 is required) and `x11-apps` is installed.
|
||||
|
||||
First, setup [Docker for Windows following the official Docker guide](https://docs.docker.com/desktop/windows/wsl/#download).
|
||||
|
||||
You need the official Docker Desktop exe: [https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe).
|
||||
|
||||
#### Using WSLg (WSL GUI which includes Wayland or X applications to run)
|
||||
|
||||
[https://github.com/microsoft/wslg](https://github.com/microsoft/wslg)
|
||||
|
||||
To use WSLg's built in X11 server, change these two lines to point Docker-OSX to it.
|
||||
|
||||
```bash
|
||||
-e "DISPLAY=${DISPLAY:-:0}" \
|
||||
-v /mnt/wslg/.X11-unix:/tmp/.X11-unix \
|
||||
```
|
||||
|
||||
See more in-depth discussion about Docker-OSX on Windows [here](https://github.com/sickcodes/Docker-OSX/issues/17) and [here](https://github.com/sickcodes/Docker-OSX/issues/60).
|
||||
|
||||
|
||||
## Additional boot instructions for when you are [creating your container](#container-creation-examples)
|
||||
|
||||
- Boot the macOS Base System (Press Enter)
|
||||
@ -817,7 +843,37 @@ docker run -it \
|
||||
# sudo -S mount_9p hostshare
|
||||
|
||||
```
|
||||
### Share Linux NFS Drive into macOS
|
||||
|
||||
To share a folder using NFS, setup a folder for on the host machine, for example, `/srv/nfs/share` and then append to `/etc/exports`:
|
||||
```bash
|
||||
/srv/nfs/share 127.0.0.1/0(insecure,rw,all_squash,anonuid=1000,anongid=985,no_subtree_check)
|
||||
```
|
||||
|
||||
You may need to reload exports now, which will begin sharing that directory.
|
||||
|
||||
```bash
|
||||
# reload shared folders
|
||||
sudo exportfs -arv
|
||||
```
|
||||
|
||||
[Source & Explanation](https://serverfault.com/questions/716350/mount-nfs-volume-on-ubuntu-linux-server-from-macos-client)
|
||||
|
||||
Give permissions on the shared folder for the `anonuid` and `anongid`, where `anonuid` and `anongid` matches that of your linux user; `id -u`
|
||||
|
||||
`id -u ; id -g` will print `userid:groupid`
|
||||
```
|
||||
chown 1000:985 /srv/nfs/share
|
||||
chmod u+rwx /srv/nfs/share
|
||||
```
|
||||
|
||||
Start the Docker-OSX container with the additional flag `--network host`
|
||||
|
||||
Create and mount the nfs folder from the mac terminal:
|
||||
```
|
||||
mkdir -p ~/mnt
|
||||
sudo mount -t nfs 10.0.2.2:/srv/nfs/share ~/mnt
|
||||
```
|
||||
|
||||
### Share USB Drive into macOS over QEMU
|
||||
|
||||
@ -1148,18 +1204,6 @@ Or tell the container to use specific ones using `-e GENERATE_SPECIFIC=true`
|
||||
-e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \
|
||||
```
|
||||
|
||||
### I'd like to run Docker-OSX on Windows
|
||||
|
||||
Running Docker-OSX on windows is possible just in WSL2 (Windows, Ubuntu).
|
||||
|
||||
Ensure KVM is enabled and `x11-apps` is installed.
|
||||
|
||||
to void troubles related to docker daemons on WLS 2, use Docker on Windows, and extern it to your distro.
|
||||
See Docker Docs for the complete detail setup [here](https://docs.docker.com/docker-for-windows/wsl/)
|
||||
|
||||
See more in-depth discussion [here](https://github.com/sickcodes/Docker-OSX/issues/17) and [here](https://github.com/sickcodes/Docker-OSX/issues/60).
|
||||
|
||||
|
||||
### Changing display resolution
|
||||
|
||||
The display resolution is controlled by this line:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -30,10 +30,11 @@ Optional options:
|
||||
--master-plist <filename> Same as above.
|
||||
--output-bootdisk <filename> Optionally change the bootdisk filename
|
||||
--output-plist <filename> Optionally change the output plist filename
|
||||
--thinkpad Sets ForceOcWriteFlash to true
|
||||
--help, -h, help Display this help and exit
|
||||
|
||||
Placeholders: {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{UUID}},
|
||||
{{ROM}}, {{WIDTH}}, {{HEIGHT}}
|
||||
{{ROM}}, {{WIDTH}}, {{HEIGHT}}, {{THINKPAD}}
|
||||
|
||||
Example:
|
||||
./generate-specific-bootdisk.sh \\
|
||||
@ -183,6 +184,12 @@ while (( "$#" )); do
|
||||
shift
|
||||
;;
|
||||
|
||||
|
||||
--thinkpad )
|
||||
export THINKPAD=true
|
||||
shift
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid option ${1}. Running with default values..."
|
||||
shift
|
||||
@ -193,12 +200,12 @@ done
|
||||
|
||||
download_qcow_efi_folder () {
|
||||
|
||||
export EFI_FOLDER=./OpenCore-Catalina/EFI
|
||||
export EFI_FOLDER=./OpenCore/EFI
|
||||
export RESOURCES_FOLDER=./resources/OcBinaryData/Resources
|
||||
|
||||
# check if we are inside OSX-KVM already
|
||||
# if not, download OSX-KVM locally
|
||||
[ -d ./OpenCore-Catalina/EFI/ ] || {
|
||||
[ -d ./OpenCore/EFI/ ] || {
|
||||
[ -d ./OSX-KVM/ ] || git clone --recurse-submodules --depth 1 https://github.com/kholia/OSX-KVM.git
|
||||
export EFI_FOLDER="./OSX-KVM/${EFI_FOLDER}"
|
||||
}
|
||||
@ -233,6 +240,13 @@ generate_bootdisk () {
|
||||
wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}"
|
||||
fi
|
||||
|
||||
if [[ "${THINKPAD}" == true ]]; then
|
||||
echo "Thinkpads: setting ForceOcWriteFlash to true"
|
||||
export THINKPAD=true
|
||||
else
|
||||
export THINKPAD=false
|
||||
fi
|
||||
|
||||
[ -e ./opencore-image-ng.sh ] \
|
||||
|| { wget "${OPENCORE_IMAGE_MAKER_URL}" \
|
||||
&& chmod +x opencore-image-ng.sh ; }
|
||||
@ -252,6 +266,7 @@ generate_bootdisk () {
|
||||
-e s/\{\{ROM\}\}/"${ROM}"/g \
|
||||
-e s/\{\{WIDTH\}\}/"${WIDTH:-1920}"/g \
|
||||
-e s/\{\{HEIGHT\}\}/"${HEIGHT:-1080}"/g \
|
||||
-e s/\{\{THINKPAD\}\}/"${THINKPAD:-false}"/g \
|
||||
"${MASTER_PLIST}" > ./tmp.config.plist || exit 1
|
||||
else
|
||||
cat <<EOF && exit 1
|
||||
|
@ -30,6 +30,7 @@ General options:
|
||||
--create-envs, --envs Create all corresponding sourcable envs
|
||||
--create-plists, --plists Create all corresponding config.plists
|
||||
--create-bootdisks, --bootdisks Create all corresponding bootdisks [SLOW]
|
||||
--thinkpad Toggles ForceOcWriteFlash to true
|
||||
--help, -h, help Display this help and exit
|
||||
|
||||
Additional options only if you are creating ONE serial set:
|
||||
@ -38,7 +39,7 @@ Additional options only if you are creating ONE serial set:
|
||||
|
||||
Custom plist placeholders:
|
||||
{{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}},
|
||||
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}
|
||||
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}, {{THINKPAD}}
|
||||
|
||||
Example:
|
||||
./generate-unique-machine-values.sh --count 1 --plists --bootdisks --envs
|
||||
@ -202,9 +203,14 @@ while (( "$#" )); do
|
||||
export CREATE_ENVS=1
|
||||
shift
|
||||
;;
|
||||
|
||||
--thinkpad )
|
||||
export THINKPAD=true
|
||||
shift
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid option. Running with default values..."
|
||||
echo "Invalid option ${1}. Running with default values..."
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
@ -226,12 +232,12 @@ download_vendor_mac_addresses () {
|
||||
|
||||
download_qcow_efi_folder () {
|
||||
|
||||
export EFI_FOLDER=./OpenCore-Catalina/EFI
|
||||
export EFI_FOLDER=./OpenCore/EFI
|
||||
export RESOURCES_FOLDER=./resources/OcBinaryData/Resources
|
||||
|
||||
# check if we are inside OSX-KVM already
|
||||
# if not, download OSX-KVM locally
|
||||
[ -d ./OpenCore-Catalina/EFI/ ] || {
|
||||
[ -d ./OpenCore/EFI/ ] || {
|
||||
[ -d ./OSX-KVM/ ] || git clone --recurse-submodules --depth 1 https://github.com/kholia/OSX-KVM.git
|
||||
export EFI_FOLDER="./OSX-KVM/${EFI_FOLDER}"
|
||||
}
|
||||
@ -313,6 +319,7 @@ export UUID="${UUID}"
|
||||
export MAC_ADDRESS="${MAC_ADDRESS}"
|
||||
export WIDTH="${WIDTH}"
|
||||
export HEIGHT="${HEIGHT}"
|
||||
export THINKPAD="${THINKPAD}"
|
||||
EOF
|
||||
|
||||
fi
|
||||
@ -333,10 +340,17 @@ EOF
|
||||
wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}"
|
||||
fi
|
||||
|
||||
if [[ "${THINKPAD}" == true ]]; then
|
||||
echo "Thinkpads: setting ForceOcWriteFlash to true"
|
||||
export THINKPAD=true
|
||||
else
|
||||
export THINKPAD=false
|
||||
fi
|
||||
|
||||
mkdir -p "${OUTPUT_DIRECTORY}/plists"
|
||||
source "${OUTPUT_ENV_FILE}"
|
||||
ROM_VALUE="${MAC_ADDRESS//\:/}"
|
||||
ROM_VALUE="${ROM_VALUE,,}"
|
||||
ROM="${MAC_ADDRESS//\:/}"
|
||||
ROM="${ROM,,}"
|
||||
sed -e s/\{\{DEVICE_MODEL\}\}/"${DEVICE_MODEL}"/g \
|
||||
-e s/\{\{SERIAL\}\}/"${SERIAL}"/g \
|
||||
-e s/\{\{BOARD_SERIAL\}\}/"${BOARD_SERIAL}"/g \
|
||||
@ -344,6 +358,7 @@ EOF
|
||||
-e s/\{\{ROM\}\}/"${ROM}"/g \
|
||||
-e s/\{\{WIDTH\}\}/"${WIDTH}"/g \
|
||||
-e s/\{\{HEIGHT\}\}/"${HEIGHT}"/g \
|
||||
-e s/\{\{THINKPAD\}\}/"${THINKPAD}"/g \
|
||||
"${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1
|
||||
fi
|
||||
|
||||
|
@ -133,26 +133,26 @@ fish part-add /dev/sda p 302048 -2048
|
||||
fish part-set-gpt-type /dev/sda 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B
|
||||
fish part-set-bootable /dev/sda 1 true
|
||||
fish mkfs vfat /dev/sda1 label:EFI
|
||||
fish mkfs vfat /dev/sda2 label:OpenCoreBoo
|
||||
fish mkfs vfat /dev/sda2 label:OpenCore
|
||||
fish mount /dev/sda2 /
|
||||
fish mkdir /ESP
|
||||
fish mount /dev/sda1 /ESP
|
||||
|
||||
msg "copy files to disk image"
|
||||
cp -v "$cfg" $WORK/config.plist
|
||||
fish mkdir /ESP/EFI
|
||||
fish mkdir /ESP/EFI/OC
|
||||
fish mkdir /ESP/EFI/OC/Kexts
|
||||
fish mkdir /ESP/EFI/OC/ACPI
|
||||
fish mkdir /ESP/EFI/OC/Resources
|
||||
fish mkdir /ESP/EFI/OC/Tools
|
||||
fish copy-in $WORK/EFI/BOOT /ESP/EFI
|
||||
fish copy-in $WORK/EFI/OC/OpenCore.efi /ESP/EFI/OC
|
||||
fish copy-in $WORK/EFI/OC/Drivers /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Kexts /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/ACPI /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Resources /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Tools /ESP/EFI/OC/
|
||||
fish mkdir /ESP/EFI
|
||||
fish mkdir /ESP/EFI/OC
|
||||
fish mkdir /ESP/EFI/OC/Kexts
|
||||
fish mkdir /ESP/EFI/OC/ACPI
|
||||
fish mkdir /ESP/EFI/OC/Resources
|
||||
fish mkdir /ESP/EFI/OC/Tools
|
||||
fish copy-in $WORK/EFI/BOOT /ESP/EFI
|
||||
fish copy-in $WORK/EFI/OC/OpenCore.efi /ESP/EFI/OC
|
||||
fish copy-in $WORK/EFI/OC/Drivers /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Kexts /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/ACPI /ESP/EFI/OC/
|
||||
fish copy-in $BASE/resources/OcBinaryData/Resources /ESP/EFI/OC/
|
||||
fish copy-in $WORK/EFI/OC/Tools /ESP/EFI/OC/
|
||||
|
||||
# Note
|
||||
fish copy-in startup.nsh /
|
||||
|
Reference in New Issue
Block a user