Add -e MAC_ADDRESS to change MAC_ADDRESS at runtime.

This commit is contained in:
sickcodes 2021-02-07 17:27:02 +00:00
parent 7a04945aae
commit 9228312eba
3 changed files with 32 additions and 3 deletions

View File

@ -1,5 +1,10 @@
|Version|Date|Notes| |Version|Date|Notes|
|---|---|---| |---|---|---|
| |2021-02-07|Add MAC_ADDRESS environment variable.|
| |2021-02-03|Employ wget --no-verbose to avoid buffer overload in hub.docker.com.|
| |2021-02-03|Reduce build size.|
| |2021-01-27|Add OSX_COMMANDS to allow runtime commands on :auto image.|
| |2021-01-26|Removed most pointless VOLUME build commands.|
|3.0|2021-01-23|Add fast mode boot straight to shell. And -v $PWD/disk.img:/image for all Dockerfiles| |3.0|2021-01-23|Add fast mode boot straight to shell. And -v $PWD/disk.img:/image for all Dockerfiles|
| |2021-01-22|Add additional helm chart instructions and files.| | |2021-01-22|Add additional helm chart instructions and files.|
| |2021-01-15|Fix helm initial disk creation process and add installation instructions.| | |2021-01-15|Fix helm initial disk creation process and add installation instructions.|

View File

@ -43,6 +43,7 @@
# -e CORES=4 # -e CORES=4
# -e EXTRA= # -e EXTRA=
# -e INTERNAL_SSH_PORT=10022 # -e INTERNAL_SSH_PORT=10022
# -e MAC_ADDRESS=
# #
# Extra QEMU args: # Extra QEMU args:
# #
@ -177,7 +178,7 @@ RUN touch Launch.sh \
&& tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 \' \ && tee -a Launch.sh <<< '-drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 \' \
&& tee -a Launch.sh <<< '-drive id=MacHDD,if=none,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=qcow2 \' \ && tee -a Launch.sh <<< '-drive id=MacHDD,if=none,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=qcow2 \' \
&& tee -a Launch.sh <<< '-device ide-hd,bus=sata.4,drive=MacHDD \' \ && 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, -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:09:49:17 \' \ && tee -a Launch.sh <<< '-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900, -device e1000-82545em,netdev=net0,id=net0,mac=${MAC_ADDRESS:-52:54:00:09:49:17} \' \
&& tee -a Launch.sh <<< '-monitor stdio \' \ && tee -a Launch.sh <<< '-monitor stdio \' \
&& tee -a Launch.sh <<< '-vga vmware \' \ && tee -a Launch.sh <<< '-vga vmware \' \
&& tee -a Launch.sh <<< '${EXTRA:-}' && tee -a Launch.sh <<< '${EXTRA:-}'
@ -187,12 +188,12 @@ RUN grep -v InstallMedia ./Launch.sh > ./Launch-nopicker.sh \
&& chmod +x ./Launch-nopicker.sh \ && chmod +x ./Launch-nopicker.sh \
&& sed -i -e s/OpenCore\.qcow2/OpenCore\-nopicker\.qcow2/ ./Launch-nopicker.sh && sed -i -e s/OpenCore\.qcow2/OpenCore\-nopicker\.qcow2/ ./Launch-nopicker.sh
USER arch
ENV USER arch ENV USER arch
ENV DISPLAY=:0.0 ENV DISPLAY=:0.0
USER arch
ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img
VOLUME ["/tmp/.X11-unix"] VOLUME ["/tmp/.X11-unix"]

View File

@ -66,8 +66,25 @@ docker run -it \
# Wait 2-3 minutes until you drop into the shell. # Wait 2-3 minutes until you drop into the shell.
``` ```
```bash ```bash
docker pull sickcodes/docker-osx:auto
# boot to OSX shell + display (19GB)
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e "DISPLAY=${DISPLAY:-:0.0}" \
sickcodes/docker-osx:auto
```
```bash
docker pull sickcodes/docker-osx:auto
# boot to OSX shell + display (19GB) + commands to run inside OSX # boot to OSX shell + display (19GB) + commands to run inside OSX
docker run -it \ docker run -it \
--device /dev/kvm \ --device /dev/kvm \
@ -581,12 +598,18 @@ docker build -t docker-osx:latest \
Pass any devices/directories to the Docker container & the QEMU arguments using the handy `-e EXTRA=` runtime options. Pass any devices/directories to the Docker container & the QEMU arguments using the handy `-e EXTRA=` runtime options.
```bash ```bash
# example customizations
docker run \ docker run \
-e RAM=4 \ -e RAM=4 \
-e SMP=4 \ -e SMP=4 \
-e CORES=4 \ -e CORES=4 \
-e EXTRA='-usb -device usb-host,hostbus=1,hostaddr=8' \ -e EXTRA='-usb -device usb-host,hostbus=1,hostaddr=8' \
-e INTERNAL_SSH_PORT=23 \ -e INTERNAL_SSH_PORT=23 \
-e MAC_ADDRESS="$(xxd -c1 -p -l 6 /dev/urandom | tr '\n' ':' | cut -c1-17)" \
-e AUDIO_DRIVER=alsa \
-e IMAGE_PATH=/image \
-e SCREEN_SHARE_PORT=5900 \
-e DISPLAY=:0 \
--device /dev/kvm \ --device /dev/kvm \
--device /dev/snd \ --device /dev/snd \
-v /tmp/.X11-unix:/tmp/.X11-unix \ -v /tmp/.X11-unix:/tmp/.X11-unix \