From 2414f466d0c6fd142734630c8206137695233575 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Wed, 24 Mar 2021 21:16:03 +0000 Subject: [PATCH] Enable interactive QEMU. Remove envsubst since we are already using bash. Add -x flag --- CHANGELOG.md | 1 + Dockerfile | 8 ++++---- Dockerfile.auto | 2 +- Dockerfile.naked | 2 +- README.md | 42 ++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc2c562..dcc665f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ |Version|Date|Notes| |---|---|---| +|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.| | |2021-03-19|Use RAM=3 as the default RAM allocation. Add instructions to clear buff/cache.| | |2021-03-17|Add RAM=max and RAM=half to dynamically select ram at runtime (DEFAULT).| diff --git a/Dockerfile b/Dockerfile index b559bb8..9330937 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ # # Title: Docker-OSX (Mac on Docker) # Author: Sick.Codes https://twitter.com/sickcodes -# Version: 4.2 +# Version: 4.3 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX # Website: https://sick.codes @@ -205,8 +205,8 @@ RUN git clone --recurse-submodules --depth 1 --branch "${BRANCH}" "${REPO}" RUN touch Launch.sh \ && chmod +x ./Launch.sh \ - && tee -a Launch.sh <<< '#!/bin/sh' \ - && tee -a Launch.sh <<< 'set -eu' \ + && 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"))"' \ @@ -340,7 +340,7 @@ CMD sudo touch /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" || true --height "${HEIGHT:-1080}" \ --output-bootdisk "${BOOTDISK:=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2}" \ ; } \ - ; ./enable-ssh.sh && envsubst < ./Launch.sh | bash + ; ./enable-ssh.sh && ./Launch.sh # virt-manager mode: eta son # CMD virsh define <(envsubst < Docker-OSX.xml) && virt-manager || virt-manager diff --git a/Dockerfile.auto b/Dockerfile.auto index ff7d5e6..8175e3e 100644 --- a/Dockerfile.auto +++ b/Dockerfile.auto @@ -7,7 +7,7 @@ # # Title: Docker-OSX (Mac on Docker) # Author: Sick.Codes https://twitter.com/sickcodes -# Version: 4.2 +# Version: 4.3 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX # Website: https://sick.codes diff --git a/Dockerfile.naked b/Dockerfile.naked index 734ea1d..6a5e397 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -7,7 +7,7 @@ # # Title: Docker-OSX (Mac on Docker) # Author: Sick.Codes https://twitter.com/sickcodes -# Version: 4.2 +# Version: 4.3 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX # Website: https://sick.codes diff --git a/README.md b/README.md index 75df715..84baac7 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ docker run -it \ -e "DISPLAY=${DISPLAY:-:0.0}" \ sickcodes/docker-osx:latest +docker pull sickcodes/docker-osx:big-sur # Big Sur docker run -it \ --device /dev/kvm \ @@ -111,7 +112,7 @@ Create your personal image using `:latest`. Then, extract the image. Afterwards, The Quick Start command should work out of the box, provided that you keep the following lines. Works in `auto` & `naked` machines: -```dockerfile +``` -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ ``` @@ -120,11 +121,48 @@ The Quick Start command should work out of the box, provided that you keep the f In that case, **remove** the two lines in your command: -```dockerfile +``` # -v /tmp/.X11-unix:/tmp/.X11-unix \ # -e "DISPLAY=${DISPLAY:-:0.0}" \ ``` +#### I need VNC to a Remote Host (Secure) + +Now you can direct connect VNC to any image! + +Add the following line: + +`-e EXTRA="-display none -vnc 0.0.0.0:99,password"` + +In the Docker terminal, press `enter` until you see `(qemu)`. + +Type `change vnc password` + +`ip n` will usually show the container IP first. + +Port is `5999`. + +Now VNC connect using the Docker container IP, for example `172.17.0.2:5999` + +You can also find the container IP: `docker inspect | jq -r '.[0].NetworkSettings.IPAddress'` + +Remote VNC over SSH: `ssh -N root@1.1.1.1 -L 5999:172.17.0.2:5999`, where `1.1.1.1` is your remote server IP and `172.17.0.2` is your LAN container IP. + +#### I need VNC on localhost (Local use only!) + +##### VNC Insecure + +**NOT TLS/HTTPS Encrypted at all!** +``` +-p 5999:5999 +-e EXTRA="-display none -vnc 0.0.0.0:99,password" +``` +VNC Connect to `localhost:5999`. + +Or `ssh -N root@1.1.1.1 -L 5999:127.0.0.1:5999`, where `1.1.1.1` is your remote server IP. + +(Note: if you close port 5999 and use the SSH tunnel, this becomes secure.) + #### I have used Docker-OSX before and wish to extract my Mac OS X image. Use `docker commit`, copy the ID, and then run `docker start -ai `.