From 9228312eba29e7916d098add64205cff2f64a474 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Sun, 7 Feb 2021 17:27:02 +0000 Subject: [PATCH] Add -e MAC_ADDRESS to change MAC_ADDRESS at runtime. --- CHANGELOG.md | 5 +++++ Dockerfile | 7 ++++--- README.md | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3d5f98..2f3d60e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ |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| | |2021-01-22|Add additional helm chart instructions and files.| | |2021-01-15|Fix helm initial disk creation process and add installation instructions.| diff --git a/Dockerfile b/Dockerfile index 5eff72a..428ab5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,7 @@ # -e CORES=4 # -e EXTRA= # -e INTERNAL_SSH_PORT=10022 +# -e MAC_ADDRESS= # # 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=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 <<< '-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 <<< '-vga vmware \' \ && tee -a Launch.sh <<< '${EXTRA:-}' @@ -187,12 +188,12 @@ 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 ENV DISPLAY=:0.0 -USER arch - ENV IMAGE_PATH=/home/arch/OSX-KVM/mac_hdd_ng.img VOLUME ["/tmp/.X11-unix"] diff --git a/README.md b/README.md index 49a5ba0..8134bbd 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,25 @@ docker run -it \ # Wait 2-3 minutes until you drop into the shell. ``` + ```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 docker run -it \ --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. ```bash +# example customizations docker run \ -e RAM=4 \ -e SMP=4 \ -e CORES=4 \ -e EXTRA='-usb -device usb-host,hostbus=1,hostaddr=8' \ -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/snd \ -v /tmp/.X11-unix:/tmp/.X11-unix \