diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9157591..8396d7d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
|Version|Date|Notes|
|---|---|---|
+| |2021-03-03|Add WIDTH and HEIGHT to set the x and y resolutions, use in conjuction with serial numbers.|
| |2021-03-02|Add ADDITIONAL_PORTS, for example `-e ADDITIONAL_PORTS='hostfwd=tcp::23-:23,'`|
|4.0|2021-02-27|Add big-sur support. Use `sickcodes/docker-osx:big-sur` or build using `--build-arg VERSION=11`|
| |2021-02-26|Change `-e NOPICKER=true` to simply do `sed -i '/^.*InstallMedia.*/d' Launch.sh` and `export BOOTDISK=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2`.|
diff --git a/Dockerfile b/Dockerfile
index bff6570..8afebe3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -259,8 +259,19 @@ ENV NETWORKING=vmxnet3
ENV NOPICKER=false
-ENV UNIQUE=false
-# Boolean for generating a bootdisk with new serials.
+# Boolean for generating a bootdisk with new random serials.
+ENV GENERATE_UNIQUE=false
+
+# Boolean for generating a bootdisk with specific serials.
+ENV GENERATE_SPECIFIC=false
+
+# boolean for skipping the disk selection menu at in the boot process
+ENV NOPICKER=false
+
+# The x and y coordinates for resolution.
+# Must be used with either -e GENERATE_UNIQUE=true or -e GENERATE_SPECIFIC=true.
+ENV WIDTH=1920
+ENV HEIGHT=1080
VOLUME ["/tmp/.X11-unix"]
@@ -296,11 +307,13 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS
; } \
; [[ "${GENERATE_UNIQUE}" == true ]] && { \
./Docker-OSX/custom/generate-unique-machine-values.sh \
- --count 1 \
- --tsv ./serial.tsv \
- --bootdisks \
- --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
- --output-env "${ENV:=/env}" || exit 1 \
+ --count 1 \
+ --tsv ./serial.tsv \
+ --bootdisks \
+ --width "${WIDTH:-1920}" \
+ --height "${HEIGHT:-1080}" \
+ --output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \
+ --output-env "${ENV:=/env}" || exit 1 \
; } \
; [[ "${GENERATE_SPECIFIC}" == true ]] && { \
source "${ENV:=/env}" \
@@ -310,6 +323,8 @@ CMD sudo chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDIS
--board-serial "${BOARD_SERIAL}" \
--uuid "${UUID}" \
--mac-address "${MAC_ADDRESS}" \
+ --width "${WIDTH:-1920}" \
+ --height "${HEIGHT:-1080}" \
--output-bootdisk "${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" || exit 1 \
; } \
; case "$(file --brief /bootdisk)" in \
diff --git a/README.md b/README.md
index 3a8b604..08cf699 100644
--- a/README.md
+++ b/README.md
@@ -493,6 +493,43 @@ sudo nohup dockerd &
sudo systemctl enable docker
```
+# How to Forward Additional Ports from the guest.
+
+This is how it visually looks:
+
+`host:10023 <-> 10023:container:10023 <-> 80:guest`
+
+```bash
+On the host
+```bash
+docker run -it \
+ --device /dev/kvm \
+ -p 50922:10022 \
+ -e ADDITIONAL_PORTS='hostfwd=tcp::10023-:80,' \
+ -p 10023:10023 \
+ sickcodes/docker-osx:auto
+```
+
+Inside the container:
+```bash
+/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+
+brew install nginx
+sudo sed -i -e 's/8080/80/' /usr/local/etc/nginx/nginx.confcd
+# sudo nginx -s stop
+sudo nginx
+```
+
+nginx should appear on the host at port 10023.
+
+You can string multiple statements, for example:
+
+```bash
+ -e ADDITIONAL_PORTS='hostfwd=tcp::10023-:80,hostfwd=tcp::10043-:443,'
+ -p 10023:10023 \
+ -p 10043:10043 \
+```
+
# How to Enable Network Forwarding
Allow ipv4 forwarding for bridged networking connections:
@@ -706,11 +743,13 @@ For serial numbers, generate them in `./custom` OR make docker generate them at
At any time, verify your serial number before logging in iCloud, etc.
```bash
+# this is a quick way to check your serial number via cli inside OSX
ioreg -l | grep IOPlatformSerialNumber
# or from the host
-sshpass -p alpine ssh user@localhost -p 50922 'ioreg -l | grep IOPlatformSerialNumber'
+sshpass -p 'alpine' ssh user@localhost -p 50922 'ioreg -l | grep IOPlatformSerialNumber'
```
+# This example generates a random set of serial numbers at runtime, headlessly
```bash
# proof of concept only, generates random serial numbers, headlessly, and quits right after.
@@ -724,6 +763,8 @@ docker run --rm -it \
sickcodes/docker-osx:auto
```
+# This example generates a specific set of serial numbers at runtime
+
```bash
# run the same as above 17gb auto image, with SSH, with nopicker, and save the bootdisk for later.
# you don't need to save the bootdisk IF you supply specific serial numbers!
@@ -743,6 +784,7 @@ docker run -it \
sickcodes/docker-osx:auto
```
+# This example generates a specific set of serial numbers at runtime, with your existing image, at 1000x1000 display resolution.
```bash
# run an existing image in current directory, with a screen, with SSH, with nopicker, and save the bootdisk for later.
@@ -762,6 +804,8 @@ docker run -it \
-e BOARD_SERIAL="C027251024NJG36UE" \
-e UUID="5CCB366D-9118-4C61-A00A-E5BAF3BED451" \
-e MAC_ADDRESS="A8:5C:2C:9A:46:2F" \
+ -e WIDTH=1000 \
+ -e HEIGHT=1000 \
-e BOOTDISK=/bootdisk \
-v "${PWD}/mynewbootdisk.qcow:/bootdisk" \
-v "${PWD}/mac_hdd_ng.img:/image" \
@@ -780,6 +824,36 @@ Or you can generate them inside the `./custom` folder. And then use:
-e MAC_ADDRESS="" \
```
+# Change Resolution Docker-OSX
+
+The display resolution is controlled by this line:
+
+https://github.com/sickcodes/Docker-OSX/blob/master/custom/config-nopicker-custom.plist#L819
+
+However, you need to mount that disk. Boring!
+
+Instead, you can simply add the following to any image:
+
+```bash
+-e GENERATE_UNIQUE=true \
+-e WIDTH=1920 \
+-e HEIGHT=1080 \
+```
+
+It will take around 1 minute longer to boot because it will make a new boot partition.
+
+```bash
+-e GENERATE_SPECIFIC=true \
+-e WIDTH=1920 \
+-e HEIGHT=1080 \
+-e SERIAL="" \
+-e BOARD_SERIAL="" \
+-e UUID="" \
+-e MAC_ADDRESS="" \
+```
+
+Must be used with either `-e GENERATE_UNIQUE=true` or `-e GENERATE_SPECIFIC=true`.
+
#### Persistence from generating serial numbers is obviously ideal:
```bash
diff --git a/custom/config-nopicker-custom.plist b/custom/config-nopicker-custom.plist
index 6166234..aa60a39 100644
--- a/custom/config-nopicker-custom.plist
+++ b/custom/config-nopicker-custom.plist
@@ -816,7 +816,7 @@
ReplaceTabWithSpace
Resolution
- 1920x1080@32
+ {{WIDTH}}x{{HEIGHT}}@32
SanitiseClearScreen
TextRenderer
diff --git a/custom/generate-specific-bootdisk.sh b/custom/generate-specific-bootdisk.sh
index 76aff0c..d5450b8 100755
--- a/custom/generate-specific-bootdisk.sh
+++ b/custom/generate-specific-bootdisk.sh
@@ -15,12 +15,14 @@ help_text="Usage: generate-specific-bootdisk.sh
General options:
--model Device model, e.g. 'iMacPro1,1'
- --serial Device Serial number.
- --board-serial Board Serial number.
- --uuid SmUUID.
- --mac-address Used to set the ROM value; lowercased and without a colon.
- --output-bootdisk Optionally change the bootdisk output filename.
- --custom-plist Optionally change the input plist.
+ --serial Device Serial number
+ --board-serial Board Serial number
+ --uuid SmUUID
+ --mac-address Used to set the ROM value; lowercased and without a colon
+ --width Resolution x axis length in pixels (default 1920)
+ --height Resolution y axis length in pixels (default 1080
+ --output-bootdisk Optionally change the bootdisk output filename
+ --custom-plist Optionally change the input plist
--help, -h, help Display this help and exit
@@ -31,7 +33,9 @@ Example:
--board-serial C027251024NJG36UE \
--uuid 5CCB366D-9118-4C61-A00A-E5BAF3BED451 \
--mac-address A8:5C:2C:9A:46:2F \
- --output-bootdisk OpenCore-nopicker.qcow2
+ --output-bootdisk OpenCore-nopicker.qcow2 \
+ --widht 1920 \
+ --height 1080
Author: Sick.Codes https://sick.codes/
Project: https://github.com/sickcodes/Docker-OSX/
@@ -97,6 +101,26 @@ while (( "$#" )); do
shift
;;
+ --width=* )
+ export WIDTH="${1#*=}"
+ shift
+ ;;
+ --width* )
+ export WIDTH="${2}"
+ shift
+ shift
+ ;;
+
+ --height=* )
+ export HEIGHT="${1#*=}"
+ shift
+ ;;
+ --height* )
+ export HEIGHT="${2}"
+ shift
+ shift
+ ;;
+
--output-bootdisk=* )
export OUTPUT_QCOW="${1#*=}"
shift
@@ -153,6 +177,8 @@ generate_bootdisk () {
-e s/{{BOARD_SERIAL}}/"${BOARD_SERIAL}"/g \
-e s/{{UUID}}/"${UUID}"/g \
-e s/{{ROM}}/"${ROM}"/g \
+ -e s/{{WIDTH}}/"${WIDTH:-1920}"/g \
+ -e s/{{HEIGHT}}/"${HEIGHT:-1080}"/g \
"${PLIST_MASTER}" > ./tmp.config.plist || exit 1
else
cat < Optionally change the bootdisk qcow output filename. Useless when count > 1.
--output-env Optionally change the bootdisk env filename. Useless when count > 1.
--output-dir Optionally change the script output location.
+ --width Resolution x axis length in pixels (default 1920)
+ --height Resolution y axis length in pixels (default 1080
--help, -h, help Display this help and exit
--plists Create corresponding config.plists for each serial set.
@@ -132,6 +134,27 @@ while (( "$#" )); do
shift
;;
+ --width=* )
+ export WIDTH="${1#*=}"
+ shift
+ ;;
+
+ --width* )
+ export WIDTH="${2}"
+ shift
+ shift
+ ;;
+
+ --height=* )
+ export HEIGHT="${1#*=}"
+ shift
+ ;;
+ --height* )
+ export HEIGHT="${2}"
+ shift
+ shift
+ ;;
+
--plists )
export CREATE_PLISTS=1
shift
@@ -231,6 +254,8 @@ export SERIAL="${SERIAL}"
export BOARD_SERIAL="${BOARD_SERIAL}"
export UUID="${UUID}"
export MAC_ADDRESS="${MAC_ADDRESS}"
+export WIDTH="${WIDTH:=1920}"
+export HEIGHT="${HEIGHT:=1080}"
EOF
# plist required for bootdisks, so create anyway.
@@ -244,6 +269,8 @@ EOF
-e s/{{BOARD_SERIAL}}/"${BOARD_SERIAL}"/g \
-e s/{{UUID}}/"${UUID}"/g \
-e s/{{ROM}}/"${ROM}"/g \
+ -e s/{{WIDTH}}/"${WIDTH}"/g \
+ -e s/{{HEIGHT}}/"${HEIGHT}"/g \
"${PLIST_MASTER}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1
fi