26 Commits

Author SHA1 Message Date
1b55c6e7e5 Change Penryn to max
As stated in QEMU 6 

Can test currently with:

`-e CPU=max \`

```
[user@hostname ~]$ qemu-system-x86_64 -cpu help
x86 Penryn                (alias configured by machine type)                        
x86 Penryn-v1             Intel Core 2 Duo P9xxx (Penryn Class Core 2)              
...
x86 base                  base CPU model type with no features enabled              
x86 host                  KVM processor with all supported host features            
x86 max                   Enables all features supported by the accelerator in the current host
```

See https://github.com/sickcodes/Docker-OSX/issues/304
2021-07-09 01:37:30 +00:00
48bc561aa9 Remove GitHub action for building
Continuing on hub.docker.com
2021-07-08 23:37:34 +00:00
866a429848 Add CPUID_FLAGS to edit the CPUID flags on the fly. 2021-07-08 23:32:26 +00:00
7014f82a30 Add link to "make it faster" scripts https://github.com/sickcodes/osx-optimizer
See: https://github.com/sickcodes/osx-optimizer
2021-07-08 23:22:01 +00:00
2374861720 Add libguestfs-tools to the requirements on Ubuntu
Fixes https://github.com/sickcodes/Docker-OSX/issues/311
2021-07-08 23:18:06 +00:00
e11f62a9ef Merge pull request #288 from johnjhacking/patch-1 2021-07-02 14:45:59 +00:00
0d70bed2ed Update fetch-macOS.py 2021-07-01 08:33:40 +00:00
0fb7c28608 Create docker build action. 2021-06-28 17:51:06 +00:00
62baabc31e Change call function to Popen
The call function can deadlock if the child process prints larger output. Use Popen with the communicate() method with you need pipes. If you switch to Popen, you'll get cleaner debugging.
2021-06-07 13:52:20 -06:00
54774ab91e Add APFS extraction instructions. 2021-05-28 22:21:57 +00:00
4e41e2bc08 Fix hero image cache. 2021-05-24 11:14:36 +00:00
64ed979a65 QEMU 6 VNC changes Documentation changes 2021-05-08 15:05:00 +00:00
a4c83df192 Merge pull request #270 from sickcodes/boot-args-cpu
Prepare nakedvnc for hub.docker.com. Add `ENV BOOT_ARGS=` to supply additon boot arguments, for example, `+vmx,rdtscp`. Add `ENV CPU=Penryn` to allow changes to the CPU emulation, for example, `Skylake-Client`
2021-05-06 07:48:00 +00:00
84e1682700 Prepare nakedvnc for hub.docker.com. Add ENV BOOT_ARGS= to supply additon boot arguments, for example, vmx,rdtscp. Add ENV CPU=Penryn to allow changes to the CPU emulation, for example, Skylake-Client 2021-05-06 05:29:26 +00:00
879b964621 Update README.md with Big Sur 11.3 Fixes 2021-05-04 09:46:00 +00:00
f5a92a394e Apply Big Sur fix update submodule from https://github.com/sickcodes/osx-serial-generator/pull/12 2021-05-04 09:36:44 +00:00
53c9b91612 Update credits 2021-05-04 08:52:52 +00:00
c31e2618c6 Disable chown warning 2021-05-04 08:52:49 +00:00
ee65907abe Update README.md 2021-05-04 04:36:54 +00:00
77307c7b24 Add cool shield from https://dockeri.co/ to README.md 2021-05-02 10:15:06 +00:00
e5f4d6cc12 Merge pull request #260 from m-zheng/patch-1 2021-04-30 07:35:01 +07:00
9ccb93101d Update README.md
add instructions to change resolution after the container is created
2021-04-28 13:14:52 +01:00
5dc2f4fd04 Temp Fix Failed to boot OSX with GENERATE_UNIQUE #244 2021-04-27 22:58:05 +00:00
e102d8c3c7 Merge pull request #258 from tinjaw/csb-z6y1e 2021-04-26 04:25:26 +00:00
c5a2a5539d initial commit 2021-04-24 09:53:28 -05:00
869b5fafd6 Merge pull request #253 from sickcodes/file-downgrade-all-images
Downgrade file to 5.39 due to libguestfs bug. All Dockerfiles though.
2021-04-18 19:29:43 +00:00
9 changed files with 176 additions and 37 deletions

View File

@ -1,5 +1,9 @@
|Version|Date|Notes| |Version|Date|Notes|
|---|---|---| |---|---|---|
| |2021-07-08|Add CPUID_FLAGS to edit the CPUID flags on the fly.|
|4.4|2021-05-06|Prepare nakedvnc for hub.docker.com. Add `ENV BOOT_ARGS=` to supply additon boot arguments, for example, `vmx,rdtscp`. Add `ENV CPU=Penryn` to allow changes to the CPU emulation, for example, `Skylake-Client`, or see [more examples here](https://manpages.ubuntu.com/manpages/disco/man7/qemu-cpu-models.7.html).|
| |2021-05-04|Disable arbitrary chown warning|
| |2021-04-27|Fixed missing sudo|
| |2021-04-18|Add LIBGUESTFS debug & trace commands, exit on fail when creating bootdisks. Silence touch errors.| | |2021-04-18|Add LIBGUESTFS debug & trace commands, exit on fail when creating bootdisks. Silence touch errors.|
|4.3|2021-03-24|Enable interactive QEMU again. Remove envsubst since we are already using bash... Add set -x flag| |4.3|2021-03-24|Enable interactive QEMU again. Remove envsubst since we are already using bash... Add set -x flag|
|4.2|2021-03-24|Add all ENV variables to each dockerfile for readability. Add RAM allocation buffer and cache drop bug fix. Add kvm and libvirt groups. Add `IMAGE_FORMAT=qcow2` to allow `IMAGE_FORMAT=raw` too.| |4.2|2021-03-24|Add all ENV variables to each dockerfile for readability. Add RAM allocation buffer and cache drop bug fix. Add kvm and libvirt groups. Add `IMAGE_FORMAT=qcow2` to allow `IMAGE_FORMAT=raw` too.|

View File

@ -79,3 +79,7 @@ This project now uses the fantastic OpenCore bootloader from the community OpenC
[@a10kiloham](https://github.com/a10kiloham) - Adding Bluebubbles as an example use case #250 [@a10kiloham](https://github.com/a10kiloham) - Adding Bluebubbles as an example use case #250
[@aronzvi](https://github.com/aronzvi) - Fixed Failed to boot OSX with GENERATE_UNIQUE #244 [@aronzvi](https://github.com/aronzvi) - Fixed Failed to boot OSX with GENERATE_UNIQUE #244
[@tinjaw](https://github.com/tinjaw) - Fixed Type #258
[@m-zheng](https://github.com/m-zheng) - Update README.md #260

View File

@ -7,7 +7,7 @@
# #
# Title: Docker-OSX (Mac on Docker) # Title: Docker-OSX (Mac on Docker)
# Author: Sick.Codes https://twitter.com/sickcodes # Author: Sick.Codes https://twitter.com/sickcodes
# Version: 4.3 # Version: 4.4
# License: GPLv3+ # License: GPLv3+
# Repository: https://github.com/sickcodes/Docker-OSX # Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes # Website: https://sick.codes
@ -198,7 +198,7 @@ RUN if [[ "${LINUX}" == true ]]; then \
; fi ; fi
# TEMP-FIX for file 5.40 libguestfs issue # TEMP-FIX for file 5.40 libguestfs issue
RUN yes | pacman -U https://archive.archlinux.org/packages/f/file/file-5.39-1-x86_64.pkg.tar.zst \ RUN yes | sudo pacman -U https://archive.archlinux.org/packages/f/file/file-5.39-1-x86_64.pkg.tar.zst \
&& patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \ && patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
&& curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \ && curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \
&& bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine." && bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine."
@ -219,7 +219,7 @@ RUN touch Launch.sh \
&& tee -a Launch.sh <<< '[[ "${RAM}" = half ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 2000000"))"' \ && 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 <<< '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:-2}000 \' \
&& tee -a Launch.sh <<< '-cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check \' \ && tee -a Launch.sh <<< '-cpu ${CPU:-max},${CPUID_FLAGS:-vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+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 <<< '-machine q35,${KVM-"accel=kvm:tcg"} \' \
&& tee -a Launch.sh <<< '-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4}} \' \ && 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 <<< '-usb -device usb-kbd -device usb-tablet \' \
@ -258,10 +258,18 @@ ENV USER arch
# for example, -e ADDITIONAL_PORTS=hostfwd=tcp::23-:23, # for example, -e ADDITIONAL_PORTS=hostfwd=tcp::23-:23,
ENV ADDITIONAL_PORTS= ENV ADDITIONAL_PORTS=
# add additional QEMU boot arguments
ENV BOOT_ARGS=
ENV BOOTDISK= ENV BOOTDISK=
# edit the CPU that is being emulated
ENV CPU=max
ENV CPUID_FLAGS='vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check,'
ENV DISPLAY=:0.0 ENV DISPLAY=:0.0
# Deprecated
ENV ENV=/env ENV ENV=/env
# Boolean for generating a bootdisk with new random serials. # Boolean for generating a bootdisk with new random serials.
@ -319,7 +327,7 @@ VOLUME ["/tmp/.X11-unix"]
# And the default serial numbers # And the default serial numbers
CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ 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}" || true \ ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \
; [[ "${NOPICKER}" == true ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2}" \ && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2}" \

View File

@ -7,7 +7,7 @@
# #
# Title: Docker-OSX (Mac on Docker) # Title: Docker-OSX (Mac on Docker)
# Author: Sick.Codes https://twitter.com/sickcodes # Author: Sick.Codes https://twitter.com/sickcodes
# Version: 4.3 # Version: 4.4
# License: GPLv3+ # License: GPLv3+
# Repository: https://github.com/sickcodes/Docker-OSX # Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes # Website: https://sick.codes
@ -100,7 +100,7 @@ RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
# TEMP-FIX for pacman issue # TEMP-FIX for pacman issue
# TEMP-FIX for file 5.40 libguestfs issue # TEMP-FIX for file 5.40 libguestfs issue
RUN yes | pacman -U https://archive.archlinux.org/packages/f/file/file-5.39-1-x86_64.pkg.tar.zst \ RUN yes | sudo pacman -U https://archive.archlinux.org/packages/f/file/file-5.39-1-x86_64.pkg.tar.zst \
&& patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \ && patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
&& curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \ && curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \
&& bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine." && bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine."
@ -141,8 +141,14 @@ RUN if [[ "${COMPLETE}" ]]; then \
ENV ADDITIONAL_PORTS= ENV ADDITIONAL_PORTS=
# add additional QEMU boot arguments
ENV BOOT_ARGS=
ENV BOOTDISK= ENV BOOTDISK=
# edit the CPU that is beign emulated
ENV CPU=Penryn
ENV DISPLAY=:99 ENV DISPLAY=:99
ENV HEADLESS=false ENV HEADLESS=false
@ -189,7 +195,7 @@ CMD echo "${BOILERPLATE}" \
; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \ ; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \
; echo "Disk is being copied between layers... Please wait a minute..." \ ; echo "Disk is being copied between layers... Please wait a minute..." \
; sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ ; 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}" || true \ ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \
; [[ "${NOPICKER}" == true ]] && { \ ; [[ "${NOPICKER}" == true ]] && { \
sed -i '/^.*InstallMedia.*/d' Launch.sh \ sed -i '/^.*InstallMedia.*/d' Launch.sh \
&& export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2}" \ && export BOOTDISK="${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2}" \

View File

@ -7,7 +7,7 @@
# #
# Title: Docker-OSX (Mac on Docker) # Title: Docker-OSX (Mac on Docker)
# Author: Sick.Codes https://twitter.com/sickcodes # Author: Sick.Codes https://twitter.com/sickcodes
# Version: 4.3 # Version: 4.4
# License: GPLv3+ # License: GPLv3+
# Repository: https://github.com/sickcodes/Docker-OSX # Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes # Website: https://sick.codes
@ -89,7 +89,7 @@ RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
# TEMP-FIX for pacman issue # TEMP-FIX for pacman issue
# TEMP-FIX for file 5.40 libguestfs issue # TEMP-FIX for file 5.40 libguestfs issue
RUN yes | pacman -U https://archive.archlinux.org/packages/f/file/file-5.39-1-x86_64.pkg.tar.zst \ RUN yes | sudo pacman -U https://archive.archlinux.org/packages/f/file/file-5.39-1-x86_64.pkg.tar.zst \
&& patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \ && patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
&& curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \ && curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \
&& bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine." && bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine."
@ -113,8 +113,14 @@ RUN mkdir -p ~/.ssh \
ENV ADDITIONAL_PORTS= ENV ADDITIONAL_PORTS=
# add additional QEMU boot arguments
ENV BOOT_ARGS=
ENV BOOTDISK= ENV BOOTDISK=
# edit the CPU that is beign emulated
ENV CPU=Penryn
ENV DISPLAY=:99 ENV DISPLAY=:99
ENV HEADLESS=false ENV HEADLESS=false
@ -154,7 +160,7 @@ ENV LIBGUESTFS_DEBUG=1
ENV LIBGUESTFS_TRACE=1 ENV LIBGUESTFS_TRACE=1
CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ 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}" || true \ ; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \
; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \
nohup Xvfb :99 -screen 0 1920x1080x16 \ nohup Xvfb :99 -screen 0 1920x1080x16 \
& until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \

124
README.md
View File

@ -12,12 +12,16 @@ Additional credits can be found here: https://github.com/sickcodes/Docker-OSX/bl
Additionally, comprehensive list of all contributors can be found here: https://github.com/sickcodes/Docker-OSX/graphs/contributors Additionally, comprehensive list of all contributors can be found here: https://github.com/sickcodes/Docker-OSX/graphs/contributors
Special thanks to [@kholia](https://twitter.com/kholia) for maintaining the upstream project, which Docker-OSX is built on top of: [OSX-KVM](https://github.com/kholia/OSX-KVM). Big thanks to [@kholia](https://twitter.com/kholia) for maintaining the upstream project, which Docker-OSX is built on top of: [OSX-KVM](https://github.com/kholia/OSX-KVM).
Big thanks to the OpenCore team over at: https://github.com/acidanthera/OpenCorePkg. Their well-maintained bootloader provides much of the great functionality that Docker-OSX users enjoy :) Also special thanks to [@thenickdude](https://github.com/thenickdude) who maintains the valuable fork [KVM-OpenCore](https://github.com/thenickdude/KVM-Opencore), which was started by [@Leoyzen](https://github.com/Leoyzen/)!
Extra special thanks to the OpenCore team over at: https://github.com/acidanthera/OpenCorePkg. Their well-maintained bootloader provides much of the great functionality that Docker-OSX users enjoy :)
If you like this project, consider contributing here or upstream! If you like this project, consider contributing here or upstream!
<a href="https://hub.docker.com/r/sickcodes/docker-osx"><img src="https://dockeri.co/image/sickcodes/docker-osx"/></a>
## Quick Start Docker-OSX ## Quick Start Docker-OSX
First time here? try [initial setup](#initial-setup), otherwise try the instructions below to use either Catalina or Big Sur. First time here? try [initial setup](#initial-setup), otherwise try the instructions below to use either Catalina or Big Sur.
@ -40,29 +44,60 @@ docker run -it \
-p 50922:10022 \ -p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \ -v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \ -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 \
sickcodes/docker-osx:big-sur sickcodes/docker-osx:big-sur
``` ```
## Make container FASTER
SEE commands in [https://github.com/sickcodes/osx-optimizer](https://github.com/sickcodes/osx-optimizer)!
- Skip the GUI login screen (at your own risk!)
- Disable spotlight indexing on macOS to heavily speed up Virual Instances.
- Disable heavy login screen wallpaper
- Disable updates (at your own risk!)
## Important notices:
**2021-05-04:** Big Sur requires an updated OpenCore.qcow2 image, simply add:
```
# this will not be required after OSX-KVM integrates the changes. No effect if you were already using this method.
-e GENERATE_UNIQUE=true \
-e MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist \
```
**2021-05-08:** QEMU 6 VNC changes:
For Docker-OSX users who are using [VNC over QEMU using](#building-a-headless-container-which-allows-insecure-vnc-on-localhost-for-local-use-only) `-e EXTRA=...`
- `password` is now `password=on`
- `change vnc password` now need a username at the end, `change vnc password someuser`
## Technical details ## Technical details
There currently four images, each with different use cases (explained [below](#container-images)): There currently four images, each with different use cases (explained [below](#container-images)):
Catalina make your own image:
[![https://img.shields.io/docker/image-size/sickcodes/docker-osx/latest?label=sickcodes%2Fdocker-osx%3Alatest](https://img.shields.io/docker/image-size/sickcodes/docker-osx/latest?label=sickcodes%2Fdocker-osx%3Alatest)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated) [![https://img.shields.io/docker/image-size/sickcodes/docker-osx/latest?label=sickcodes%2Fdocker-osx%3Alatest](https://img.shields.io/docker/image-size/sickcodes/docker-osx/latest?label=sickcodes%2Fdocker-osx%3Alatest)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated)
[![https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked?label=sickcodes%2Fdocker-osx%3Anaked](https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked?label=sickcodes%2Fdocker-osx%3Anaked)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated) Big-Sur make your own image:
[![https://img.shields.io/docker/image-size/sickcodes/docker-osx/big-sur?label=sickcodes%2Fdocker-osx%3Abig-sur](https://img.shields.io/docker/image-size/sickcodes/docker-osx/big-sur?label=sickcodes%2Fdocker-osx%3Abig-sur)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated) [![https://img.shields.io/docker/image-size/sickcodes/docker-osx/big-sur?label=sickcodes%2Fdocker-osx%3Abig-sur](https://img.shields.io/docker/image-size/sickcodes/docker-osx/big-sur?label=sickcodes%2Fdocker-osx%3Abig-sur)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated)
Pre-made system by [Sick.Codes](https://sick.codes): username: `user`, password: `alpine`
[![https://img.shields.io/docker/image-size/sickcodes/docker-osx/auto?label=sickcodes%2Fdocker-osx%3Aauto](https://img.shields.io/docker/image-size/sickcodes/docker-osx/auto?label=sickcodes%2Fdocker-osx%3Aauto)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated) [![https://img.shields.io/docker/image-size/sickcodes/docker-osx/auto?label=sickcodes%2Fdocker-osx%3Aauto](https://img.shields.io/docker/image-size/sickcodes/docker-osx/auto?label=sickcodes%2Fdocker-osx%3Aauto)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated)
This special set of images was developed by [Sick.Codes](https://sick.codes). Bring-your-own-image setup (use any of the above first):
The images (excluding `:naked`) launch a container with an existing installation with a couple of premade configurations: [![https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked?label=sickcodes%2Fdocker-osx%3Anaked](https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked?label=sickcodes%2Fdocker-osx%3Anaked)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated)
- username: `user`, password: `alpine`
## Capabilities
- SSH enabled (`localhost:50922`) - SSH enabled (`localhost:50922`)
- VNC enabled (`localhost:8888`) if using ./vnc version - VNC enabled (`localhost:8888`) if using ./vnc version
- VNC enabled (`localhost:8888`) if using ./vnc version
- auto-updates disabled
- [serial number generator!](https://github.com/sickcodes/osx-serial-generator) - [serial number generator!](https://github.com/sickcodes/osx-serial-generator)
- X11 forwarding is enabled - X11 forwarding is enabled
- runs on top of QEMU + KVM - runs on top of QEMU + KVM
@ -127,7 +162,7 @@ In case you're interested, contact [@sickcodes on Twitter](https://twitter.com/s
Docker-OSX is licensed under the [GPL v3+](LICENSE). Contributions are welcomed and immensely appreciated. You are in-fact permitted to use Docker-OSX as a tool to create proprietary software. Docker-OSX is licensed under the [GPL v3+](LICENSE). Contributions are welcomed and immensely appreciated. You are in-fact permitted to use Docker-OSX as a tool to create proprietary software.
### Other cool Docker/QEMU based projects ### Other cool Docker/QEMU based projects
- [Run Android in a Docker Container with Dock Droid](https://github.com/sickcodes/dock-droid)
- [Run iOS in a Docker container with Docker-eyeOS](https://github.com/sickcodes/Docker-eyeOS) - [https://github.com/sickcodes/Docker-eyeOS](https://github.com/sickcodes/Docker-eyeOS) - [Run iOS in a Docker container with Docker-eyeOS](https://github.com/sickcodes/Docker-eyeOS) - [https://github.com/sickcodes/Docker-eyeOS](https://github.com/sickcodes/Docker-eyeOS)
- [Run iMessage relayer in Docker with Bluebubbles.app](https://bluebubbles.app/) - [Getting started wiki](https://github.com/BlueBubblesApp/BlueBubbles-Server/wiki/Running-via-Docker) - [Run iMessage relayer in Docker with Bluebubbles.app](https://bluebubbles.app/) - [Getting started wiki](https://github.com/BlueBubblesApp/BlueBubbles-Server/wiki/Running-via-Docker)
@ -149,7 +184,7 @@ There are several different Docker-OSX images available which are suitable for d
- `sickcodes/docker-osx:latest` - [I want to use Docker-OSX to develop/secure apps in Xcode (sign into Xcode, Transporter)](#quick-start-your-own-image-naked-container-image) - `sickcodes/docker-osx:latest` - [I want to use Docker-OSX to develop/secure apps in Xcode (sign into Xcode, Transporter)](#quick-start-your-own-image-naked-container-image)
- `sickcodes/docker-osx:naked` - [I want to use Docker-OSX for CI/CD-related purposes (sign into Xcode, Transporter)](#building-a-headless-container-from-a-custom-image) - `sickcodes/docker-osx:naked` - [I want to use Docker-OSX for CI/CD-related purposes (sign into Xcode, Transporter)](#building-a-headless-container-from-a-custom-image)
Create your personal image using `:latest`. Then, extract the image. Afterwards, you will be able to duplicate that image and import it to the `:naked` container, in order to revert the container to a previous state repeatedly. Create your personal image using `:latest` or `big-sur`. Then, pull the image out the image. Afterwards, you will be able to duplicate that image and import it to the `:naked` container, in order to revert the container to a previous state repeatedly.
- `sickcodes/docker-osx:auto` - [I'm only interested in using the command line (useful for compiling software or using Homebrew headlessly).](#prebuilt-image-with-arbitrary-command-line-arguments) - `sickcodes/docker-osx:auto` - [I'm only interested in using the command line (useful for compiling software or using Homebrew headlessly).](#prebuilt-image-with-arbitrary-command-line-arguments)
- `sickcodes/docker-osx:naked` - [I need iMessage/iCloud for security research.](#generating-serial-numbers) - `sickcodes/docker-osx:naked` - [I need iMessage/iCloud for security research.](#generating-serial-numbers)
@ -165,7 +200,7 @@ Then, you'll need QEMU and some other dependencies on your host:
sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison iptables-nft edk2-ovmf sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison iptables-nft edk2-ovmf
# UBUNTU DEBIAN # UBUNTU DEBIAN
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager libguestfs-tools
# CENTOS RHEL FEDORA # CENTOS RHEL FEDORA
sudo yum install libvirt qemu-kvm sudo yum install libvirt qemu-kvm
@ -884,6 +919,23 @@ Here's a few other resolutions! If you resolution is invalid, it will default to
-e HEIGHT=1600 \ -e HEIGHT=1600 \
``` ```
#### This example shows how to change resolution after the container is created.
First step is to stop the docker daemon
```
sudo systemctl stop docker
```
The second step is to change container config in
```
/var/lib/docker/containers/[container-id]/config.v2.json
```
(Suppose your original WIDTH is 1024 and HEIGHT is 768, you can search 1024 and replace it with the new value. Same for 768.)
The last step is to restart the docker daemon
```
sudo systemctl restart docker
```
### Mounting physical disks in Mac OSX ### Mounting physical disks in Mac OSX
Pass the disk into the container as a volume and then pass the disk again into QEMU command line extras with. Pass the disk into the container as a volume and then pass the disk again into QEMU command line extras with.
@ -918,6 +970,45 @@ docker run -it \
See also: [here](https://github.com/sickcodes/Docker-OSX/issues/222). See also: [here](https://github.com/sickcodes/Docker-OSX/issues/222).
#### Extracting the APFS disk on Linux
In Docker-OSX, we are using `qcow2` images.
This means the image grows as you use it, but the guest OS thinks you have 200GB available.
**READ ONLY**
```bash
# mount the qemu image like a real disk
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 ./image.img
sudo fdisk /dev/nbd0 -l
mkdir -p ./mnt
sudo mount /dev/nbd0p1 ./mnt
# inspect partitions (2 partitions)
sudo fdisk /dev/nbd0 -l
# mount using apfs-linux-rw OR apfs-fuse
mkdir -p ./part
sudo mount /dev/nbd0p2 ./part
sudo apfs-fuse -o allow_other /dev/nbd0p2 ./part
```
When you are finishing looking at your disk, you can unmount the partition, the disk, and remove the loopback device:
```bash
sudo umount ./part
sudo umount ./mnt
sudo qemu-nbd --disconnect /dev/nbd0
sudo rmmod nbd
```
### USB Passthrough ### USB Passthrough
Firstly, QEMU must be started as root. Firstly, QEMU must be started as root.
@ -1102,11 +1193,12 @@ docker run -i \
-p 5999:5999 \ -p 5999:5999 \
-v /tmp/.X11-unix:/tmp/.X11-unix \ -v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \ -e "DISPLAY=${DISPLAY:-:0.0}" \
-e EXTRA="-display none -vnc 0.0.0.0:99,password" \ -e EXTRA="-display none -vnc 0.0.0.0:99,password=on" \
sickcodes/docker-osx:big-sur sickcodes/docker-osx:big-sur
# type `change vnc password` into the docker terminal and set a password # type `change vnc password myvncusername` into the docker terminal and set a password
# connect to localhost:5999 using VNC # connect to localhost:5999 using VNC
# qemu 6 seems to require a username for vnc now
``` ```
**NOT TLS/HTTPS Encrypted at all!** **NOT TLS/HTTPS Encrypted at all!**
@ -1119,11 +1211,13 @@ Or `ssh -N root@1.1.1.1 -L 5999:127.0.0.1:5999`, where `1.1.1.1` is your remote
Add the following line: Add the following line:
`-e EXTRA="-display none -vnc 0.0.0.0:99,password"` `-e EXTRA="-display none -vnc 0.0.0.0:99,password=on"`
In the Docker terminal, press `enter` until you see `(qemu)`. In the Docker terminal, press `enter` until you see `(qemu)`.
Type `change vnc password` Type `change vnc password someusername`
Enter a password for your new vnc username^.
You also need the container IP: `docker inspect <containerid> | jq -r '.[0].NetworkSettings.IPAddress'` You also need the container IP: `docker inspect <containerid> | jq -r '.[0].NetworkSettings.IPAddress'`

View File

@ -87,8 +87,8 @@ class ReplicationError(Exception):
def cmd_exists(cmd): def cmd_exists(cmd):
return subprocess.call("type " + cmd, shell=True, return subprocess.Popen("type " + cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
def replicate_url(full_url, def replicate_url(full_url,

View File

@ -3,11 +3,11 @@
# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / # / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ /
# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / # / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| /
# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | # / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / |
# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :NAKED # /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :NAKEDVNC
# #
# Title: Docker-OSX (Mac on Docker) # Title: Docker-OSX (Mac on Docker)
# Author: Sick.Codes https://twitter.com/sickcodes # Author: Sick.Codes https://twitter.com/sickcodes
# Version: 4.3 # Version: 4.4
# License: GPLv3+ # License: GPLv3+
# Repository: https://github.com/sickcodes/Docker-OSX # Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes # Website: https://sick.codes
@ -19,15 +19,15 @@
# #
# Build: # Build:
# #
# docker build -t docker-osx:naked -f Dockerfile.naked . # docker build -t docker-osx:nakedvnc -f Dockerfile.nakedvnc .
# #
# Run headless: # Run headless:
# #
# docker run -it --device /dev/kvm -p 50922:10022 -v ${PWD}/mac_hdd_ng.img:/image docker-osx:naked # docker run -it --device /dev/kvm -p 50922:10022 -v ${PWD}/mac_hdd_ng.img:/image docker-osx:nakedvnc
# #
# Run with display: # Run with display:
# #
# 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 # 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:nakedvnc
# #
FROM sickcodes/docker-osx:latest FROM sickcodes/docker-osx:latest
@ -106,8 +106,14 @@ RUN mkdir -p ~/.ssh \
ENV ADDITIONAL_PORTS= ENV ADDITIONAL_PORTS=
# add additional QEMU boot arguments
ENV BOOT_ARGS=
ENV BOOTDISK= ENV BOOTDISK=
# edit the CPU that is beign emulated
ENV CPU=Penryn
ENV DISPLAY=:99 ENV DISPLAY=:99
ENV HEADLESS=false ENV HEADLESS=false
@ -142,8 +148,12 @@ ENV RAM=8
ENV WIDTH=1920 ENV WIDTH=1920
ENV HEIGHT=1080 ENV HEIGHT=1080
CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \ # libguestfs verbose
; sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true \ 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 \
; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \
nohup Xvfb :99 -screen 0 1920x1080x16 \ nohup Xvfb :99 -screen 0 1920x1080x16 \
& until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \
@ -163,7 +173,7 @@ CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true
--height "${HEIGHT:-1080}" \ --height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
--output-env "${ENV:=/env}" \ --output-env "${ENV:=/env}" \
; } \ || exit 1 ; } \
; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \
source "${ENV:=/env}" 2>/dev/null \ source "${ENV:=/env}" 2>/dev/null \
; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \
@ -176,7 +186,7 @@ CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true
--width "${WIDTH:-1920}" \ --width "${WIDTH:-1920}" \
--height "${HEIGHT:-1080}" \ --height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
; } \ || exit 1 ; } \
# ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh # ; ./enable-ssh.sh && /bin/bash -c ./Launch.sh
WORKDIR /home/arch/OSX-KVM WORKDIR /home/arch/OSX-KVM
@ -189,6 +199,13 @@ RUN sudo pacman -Syyuu --noconfirm \
&& tee -a ~/.vnc/config <<< 'localhost' \ && tee -a ~/.vnc/config <<< 'localhost' \
&& tee -a ~/.vnc/config <<< 'alwaysshared' && tee -a ~/.vnc/config <<< 'alwaysshared'
# TEMP-FIX for file 5.40 libguestfs issue
RUN yes | sudo pacman -U https://archive.archlinux.org/packages/f/file/file-5.39-1-x86_64.pkg.tar.zst \
&& patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst \
&& curl -LO "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/${patched_glibc}" \
&& bsdtar -C / -xvf "${patched_glibc}" || echo "Everything is fine."
# TEMP-FIX for file 5.40 libguestfs issue
RUN printf '\n%s\n' \ RUN printf '\n%s\n' \
'sudo rm -f /tmp/.X99-lock' \ 'sudo rm -f /tmp/.X99-lock' \
'export DISPLAY=:99' \ 'export DISPLAY=:99' \