From 61012cf0c8d92127e93ddc347e988c5c2b1cf5e6 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Wed, 25 Aug 2021 23:05:17 +0000 Subject: [PATCH 1/2] Add new image `docker pull sickcodes/docker-osx:naked-auto`. Also allow -e USERNAME -e PASSWORD for auto, even though it's 20GB. --- CHANGELOG.md | 1 + Dockerfile | 2 +- Dockerfile.auto | 16 +-- Dockerfile.naked | 2 +- Dockerfile.naked-auto | 232 ++++++++++++++++++++++++++++++++++++++++++ README.md | 134 +++++++++++++++++------- 6 files changed, 341 insertions(+), 46 deletions(-) create mode 100644 Dockerfile.naked-auto diff --git a/CHANGELOG.md b/CHANGELOG.md index feaeb79..29d9e40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ |Version|Date|Notes| |---|---|---| +|6.0|2021-08-25|Added naked-auto. Keep kernel at 5.13, even tho it's just for supermin.| |5.0|2021-07-25|Retire glibc patch. Retire file command patch. Add bootmenu=on.| | |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).| diff --git a/Dockerfile b/Dockerfile index 1e0989f..d37a22f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ # # Title: Docker-OSX (Mac on Docker) # Author: Sick.Codes https://twitter.com/sickcodes -# Version: 5.0 +# Version: 6.0 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX # Website: https://sick.codes diff --git a/Dockerfile.auto b/Dockerfile.auto index 0a58725..cc023d8 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.4 +# Version: 6.0 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX # Website: https://sick.codes @@ -171,6 +171,10 @@ ENV NETWORKING=vmxnet3 ENV NOPICKER=true +# set the username and password for automatically logging in +ENV USERNAME=user +ENV PASSWORD=alpine + # dynamic RAM options for runtime ENV RAM=3 # ENV RAM=max @@ -207,7 +211,7 @@ CMD echo "${BOILERPLATE}" \ --bootdisks \ --width "${WIDTH:-1920}" \ --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}" \ || exit 1 ; } \ ; [[ "${GENERATE_SPECIFIC}" == true ]] && { \ @@ -221,7 +225,7 @@ CMD echo "${BOILERPLATE}" \ --mac-address "${MAC_ADDRESS}" \ --width "${WIDTH:-1920}" \ --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 ; } \ ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ nohup Xvfb :99 -screen 0 1920x1080x16 \ @@ -236,13 +240,13 @@ CMD echo "${BOILERPLATE}" \ ; } \ ; /bin/bash -c ./Launch.sh \ & echo "Booting Docker-OSX in the background. Please wait..." \ - ; until [[ "$(sshpass -palpine ssh-copy-id -f -i ~/.ssh/id_docker_osx.pub -p 10022 user@127.0.0.1)" ]]; do \ + ; until [[ "$(sshpass -p${MAC_PASSWORD} ssh-copy-id -f -i ~/.ssh/id_docker_osx.pub -p 10022 ${USERNAME}@127.0.0.1)" ]]; do \ echo "Disk is being copied between layers. Repeating until able to copy SSH key into OSX..." \ ; sleep 1 \ ; done \ ; grep id_docker_osx ~/.ssh/config || { \ tee -a ~/.ssh/config <<< 'Host 127.0.0.1' \ - ; tee -a ~/.ssh/config <<< ' User user' \ + ; tee -a ~/.ssh/config <<< " User ${USERNAME:=user}" \ ; tee -a ~/.ssh/config <<< ' Port 10022' \ ; tee -a ~/.ssh/config <<< ' IdentityFile ~/.ssh/id_docker_osx' \ ; tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ @@ -251,7 +255,7 @@ CMD echo "${BOILERPLATE}" \ && echo 'Default username: user' \ && echo 'Default password: alpine' \ && echo 'Change it immediately using the command: passwd' \ - && ssh -i ~/.ssh/id_docker_osx user@127.0.0.1 -p 10022 "${OSX_COMMANDS}" + && ssh -i ~/.ssh/id_docker_osx ${USERNAME:=user}@127.0.0.1 -p 10022 "${OSX_COMMANDS}" # username: user # password: alpine diff --git a/Dockerfile.naked b/Dockerfile.naked index 481bc43..7f2dbb2 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.4 +# Version: 6.0 # License: GPLv3+ # Repository: https://github.com/sickcodes/Docker-OSX # Website: https://sick.codes diff --git a/Dockerfile.naked-auto b/Dockerfile.naked-auto new file mode 100644 index 0000000..4bf2d03 --- /dev/null +++ b/Dockerfile.naked-auto @@ -0,0 +1,232 @@ +#!/usr/bin/docker +# ____ __ ____ ______ __ +# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ / +# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| / +# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / | +# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_| :NAKED-AUTO +# +# Title: Docker-OSX (Mac on Docker) +# Author: Sick.Codes https://twitter.com/sickcodes +# Version: 6.0 +# License: GPLv3+ +# Repository: https://github.com/sickcodes/Docker-OSX +# Website: https://sick.codes +# +# This Dockerfile needs you to supply a pre-installed installation of Docker-OSX! +# +# Visit https://github.com/sickcodes/Docker-OSX for info + +FROM sickcodes/docker-osx:latest + +MAINTAINER 'https://twitter.com/sickcodes' + +USER root + +WORKDIR /root + +RUN rm -f /home/arch/OSX-KVM/mac_hdd_ng.img + +# For taking screenshots of the Xfvb screen, useful during development. +ARG SCROT + +# OPTIONAL: Arch Linux server mirrors for super fast builds +# set RANKMIRRORS to any value other that nothing, e.g. -e RANKMIRRORS=true +ARG RANKMIRRORS +ARG MIRROR_COUNTRY=US +ARG MIRROR_COUNT=10 + +RUN if [[ "${RANKMIRRORS}" ]]; then \ + { pacman -Sy wget --noconfirm || pacman -Syu wget --noconfirm ; } \ + ; wget -O ./rankmirrors "https://raw.githubusercontent.com/sickcodes/Docker-OSX/master/rankmirrors" \ + ; wget -O- "https://www.archlinux.org/mirrorlist/?country=${MIRROR_COUNTRY:-US}&protocol=https&use_mirror_status=on" \ + | sed -e 's/^#Server/Server/' -e '/^#/d' \ + | head -n "$((${MIRROR_COUNT:-10}+1))" \ + | bash ./rankmirrors --verbose --max-time 5 - > /etc/pacman.d/mirrorlist \ + && tee -a /etc/pacman.d/mirrorlist <<< 'Server = http://mirrors.evowise.com/archlinux/$repo/os/$arch' \ + && tee -a /etc/pacman.d/mirrorlist <<< 'Server = http://mirror.rackspace.com/archlinux/$repo/os/$arch' \ + && tee -a /etc/pacman.d/mirrorlist <<< 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' \ + && cat /etc/pacman.d/mirrorlist \ + ; fi \ + ; yes | pacman -Scc + +# For taking screenshots of the Xfvb screen, useful during development. +ARG SCROT + +RUN pacman -Syu xorg-server-xvfb wget xterm xorg-xhost xorg-xrandr sshpass --noconfirm \ + && if [[ "${SCROT}" ]]; then \ + pacman -Syu scrot base-devel --noconfirm \ + && git clone --recurse-submodules --depth 1 https://github.com/stolk/imcat.git \ + && cd imcat \ + && make \ + && sudo cp imcat /usr/bin/imcat \ + && touch /usr/bin/scrotcat \ + && tee -a /usr/bin/scrotcat <<< '/usr/bin/imcat <(scrot -o /dev/stdout)' \ + && chmod +x /usr/bin/scrotcat \ + ; else \ + touch /usr/bin/scrotcat \ + && echo echo >> /usr/bin/scrotcat \ + && chmod +x /usr/bin/scrotcat \ + ; fi \ + ; yes | pacman -Scc + +USER arch + +ENV USER arch + +# 5.13 problem +ENV SUPERMIN_KERNEL=/boot/vmlinuz-linux + +ENV SUPERMIN_MODULES=/lib/modules/5.12.14-arch1-1 + +ENV SUPERMIN_KERNEL_VERSION=5.12.14-arch1-1 + +RUN sudo pacman -Rns linux --noconfirm \ + ; sudo pacman -Syy \ + ; sudo pacman -S mkinitcpio --noconfirm \ + ; sudo pacman -U https://archive.archlinux.org/packages/l/linux/linux-5.12.14.arch1-1-x86_64.pkg.tar.zst --noconfirm \ + ; sudo rm -rf /var/tmp/.guestfs-* \ + ; libguestfs-test-tool + +WORKDIR /home/arch/OSX-KVM + +RUN mkdir -p ~/.ssh \ + && touch ~/.ssh/authorized_keys \ + && touch ~/.ssh/config \ + && chmod 700 ~/.ssh \ + && chmod 600 ~/.ssh/config \ + && chmod 600 ~/.ssh/authorized_keys \ + && tee -a ~/.ssh/config <<< 'Host *' \ + && tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ + && tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null' + +ARG COMPLETE= + +# use the COMPLETE arg, for a complete image, ready to boot. +# otherwise use your own image: -v "$PWD/disk.img":/image +ARG WGET_OPTIONS= +# ARG WGET_OPTIONS='--no-verbose' + +# Feel free to take a copy of this image and then host it internally +ARG IMAGE_URL= +# ARG IMAGE_URL='https://images.sick.codes/mac_hdd_ng_auto_big_sur.img' + +RUN if [[ "${COMPLETE}" ]]; then \ + echo "Downloading your image... This step might take a while... Press Ctrl+C if you want to abort." \ + ; rm -f /home/arch/OSX-KVM/mac_hdd_ng.img \ + && wget ${WGET_OPTIONS} -O /home/arch/OSX-KVM/mac_hdd_ng.img "${IMAGE_URL}" \ + ; fi + +#### SPECIAL RUNTIME ARGUMENTS BELOW + +ENV ADDITIONAL_PORTS= + +# add additional QEMU boot arguments +ENV BOOT_ARGS= + +ENV BOOTDISK= + +# edit the CPU that is beign emulated +ENV CPU=Penryn + +ENV DISPLAY=:99 + +ENV HEADLESS=false + +ENV ENV=/env + +# 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 + +ENV IMAGE_PATH=/image +ENV IMAGE_FORMAT=qcow2 + +ENV KVM='accel=kvm:tcg' + +# ENV MASTER_PLIST_URL="https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist" + +# ENV NETWORKING=e1000-82545em +ENV NETWORKING=vmxnet3 + +ENV NOPICKER=true + +# dynamic RAM options for runtime +ENV RAM=3 +# ENV RAM=max +# ENV RAM=half + +# 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 + +# libguestfs verbose +ENV LIBGUESTFS_DEBUG=1 +ENV LIBGUESTFS_TRACE=1 + +ENV TERMS_OF_USE=i_agree + +ENV BOILERPLATE="By using this Dockerfile, you hereby agree that you are a security reseacher or developer and agree to use this Dockerfile to make the world a safer place. Examples include: making your apps safer, finding your mobile phone, compiling security products, etc. You understand that Docker-OSX is an Open Source project, which is released to the public under the GNU Pulic License version 3 and above. You acknowledge that the Open Source project is absolutely unaffiliated with any third party, in any form whatsoever. Any trademarks or intelectual property which happen to be mentioned anywhere in or around the project are owned by their respective owners. By using this Dockerfile, you agree to agree to the EULA of each piece of upstream or downstream software. The following code is released for the sole purpose of security research, under the GNU Public License version 3. If you are concerned about the licensing, please note that this project is not AGPL. A copy of the license is available online: https://github.com/sickcodes/Docker-OSX/blob/master/LICENSE. In order to use the following Dockerfile you must read and understand the terms. Once you have read the terms, use the -e TERMS_OF_USE=i_agree or -e TERMS_OF_USE=i_disagree" + +CMD echo "${BOILERPLATE}" \ + ; [[ "${TERMS_OF_USE}" = i_agree ]] || exit 1 \ + ; 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 chown -R $(id -u):$(id -g) /dev/kvm /dev/snd "${IMAGE_PATH}" "${BOOTDISK}" "${ENV}" 2>/dev/null || true \ + ; { [[ "${DISPLAY}" = ':99' ]] || [[ "${HEADLESS}" == true ]] ; } && { \ + nohup Xvfb :99 -screen 0 1920x1080x16 \ + & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ + ; } \ + ; [[ "${NOPICKER}" == true ]] && { \ + 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.qcow2}" \ + ; [[ "${GENERATE_UNIQUE}" == true ]] && { \ + ./Docker-OSX/osx-serial-generator/generate-unique-machine-values.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --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}" 2>/dev/null \ + ; ./Docker-OSX/osx-serial-generator/generate-specific-bootdisk.sh \ + --master-plist-url="${MASTER_PLIST_URL}" \ + --model "${DEVICE_MODEL}" \ + --serial "${SERIAL}" \ + --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 ; } \ + ; stat "${IMAGE_PATH}" \ + ; echo "Large image is being copied between layers, please wait a minute..." \ + ; ./enable-ssh.sh \ + ; [[ -e ~/.ssh/id_docker_osx ]] || { \ + /usr/bin/ssh-keygen -t rsa -f ~/.ssh/id_docker_osx -q -N "" \ + && chmod 600 ~/.ssh/id_docker_osx \ + ; } \ + ; /bin/bash -c ./Launch.sh \ + & echo "Booting Docker-OSX in the background. Please wait..." \ + ; until [[ "$(sshpass -p${MAC_PASSWORD:=alpine} ssh-copy-id -f -i ~/.ssh/id_docker_osx.pub -p 10022 ${USERNAME:=user}@127.0.0.1)" ]]; do \ + echo "Disk is being copied between layers. Repeating until able to copy SSH key into OSX..." \ + ; sleep 1 \ + ; done \ + ; grep id_docker_osx ~/.ssh/config || { \ + tee -a ~/.ssh/config <<< 'Host 127.0.0.1' \ + ; tee -a ~/.ssh/config <<< " User ${USERNAME:=user}" \ + ; tee -a ~/.ssh/config <<< ' Port 10022' \ + ; tee -a ~/.ssh/config <<< ' IdentityFile ~/.ssh/id_docker_osx' \ + ; tee -a ~/.ssh/config <<< ' StrictHostKeyChecking no' \ + ; tee -a ~/.ssh/config <<< ' UserKnownHostsFile=/dev/null' \ + ; } \ + && ssh -i ~/.ssh/id_docker_osx ${USERNAME:=user}@127.0.0.1 -p 10022 "${OSX_COMMANDS}" diff --git a/README.md b/README.md index 76bfa58..c3a0ba9 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,65 @@ docker run -it \ sickcodes/docker-osx:big-sur ``` +#### Run Catalina Pre-Installed [![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) + +```bash +# 40GB disk space required: 20GB original image 20GB your container. +docker pull sickcodes/docker-osx:auto + +# boot directly into a real OS X shell with a visual display [NOT HEADLESS] +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 + +# username is user +# passsword is alpine +``` + +#### Download the image manually and use it in Docker + +[![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) + + +This is a particularly good way for downloading the container, in case Docker's CDN (or your connection) happens to be slow. + +```bash +wget https://images2.sick.codes/mac_hdd_ng_auto.img + +docker run -it \ + --device /dev/kvm \ + -p 50922:10022 \ + -v "${PWD}/mac_hdd_ng_auto.img:/image" \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e "DISPLAY=${DISPLAY:-:0.0}" \ + sickcodes/docker-osx:naked +``` + + +#### Use your own image and manually and automatically log into a shell + +[![https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked-auto?label=sickcodes%2Fdocker-osx%3Anaked-auto](https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked-auto?label=sickcodes%2Fdocker-osx%3Anaked-auto)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated) + + +Enable SSH in network sharing inside the guest first. Change `-e "USERNAME=user"` and `-e "USERNAME=password"` to your credentials. The container will add itself to `~/.ssh/authorized_keys` + +```bash +wget https://images2.sick.codes/mac_hdd_ng_auto.img + +docker run -it \ + --device /dev/kvm \ + -p 50922:10022 \ + -v "${PWD}/mac_hdd_ng_auto.img:/image" \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e "DISPLAY=${DISPLAY:-:0.0}" \ + -e "USERNAME=user" \ + -e "DISPLAY=alpine" \ + sickcodes/docker-osx:naked-auto +``` + ## Make container FASTER SEE commands in [https://github.com/sickcodes/osx-optimizer](https://github.com/sickcodes/osx-optimizer)! @@ -68,7 +127,13 @@ SEE commands in [https://github.com/sickcodes/osx-optimizer](https://github.com/ ## Technical details -There currently four images, each with different use cases (explained [below](#container-images)): +There currently five images, each with different use cases (explained [below](#container-images)): + +- Catalina +- Big Sur +- Auto (pre-made Catalina) +- Naked (use your own .img) +- Naked-Auto (user your own .img and SSH in) Catalina make your own image: @@ -86,6 +151,10 @@ Bring-your-own-image setup (use any of the above first): [![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) +Same as above but with `-e USERNAME` & `-e PASSWORD` and `-e OSX_COMMANDS="put your commands here"` + +[![https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked-auto?label=sickcodes%2Fdocker-osx%3Anaked-auto](https://img.shields.io/docker/image-size/sickcodes/docker-osx/naked-auto?label=sickcodes%2Fdocker-osx%3Anaked-auto)](https://hub.docker.com/r/sickcodes/docker-osx/tags?page=1&ordering=last_updated) + ## Capabilities - SSH enabled (`localhost:50922`) - VNC enabled (`localhost:8888`) if using ./vnc version @@ -1106,29 +1175,12 @@ The Quick Start command should work out of the box, provided that you keep the f -e "DISPLAY=${DISPLAY:-:0.0}" \ ``` -#### Download the image manually and use it in Docker - -[![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) - - -This is a particularly good way for downloading the container, in case Docker's CDN (or your connection) happens to be slow. - -```bash -wget https://images2.sick.codes/mac_hdd_ng_auto.img - -docker run -it \ - --device /dev/kvm \ - -p 50922:10022 \ - -v "${PWD}/mac_hdd_ng_auto.img:/image" \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - -e "DISPLAY=${DISPLAY:-:0.0}" \ - sickcodes/docker-osx:naked -``` - #### Prebuilt image with arbitrary command line arguments [![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) +`-e OSX_COMMANDS` lets you run any commands inside the container + ```bash docker pull sickcodes/docker-osx:auto @@ -1138,12 +1190,35 @@ docker run -it \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ - -e "OSX_COMMANDS=/bin/bash -c \"pwd && uname -a\"" \ + -e "OSX_COMMANDS=/bin/bash -c \"put your commands here\"" \ sickcodes/docker-osx:auto # Boots in a minute or two! ``` + +```bash + +OR if you have an image already and just want to log in and execute arbitrary commands: + +```bash +docker pull sickcodes/docker-osx:naked-auto + +# boot to OS X shell + display + specify commands to run inside OS X! +docker run -it \ + --device /dev/kvm \ + -p 50922:10022 \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e "DISPLAY=${DISPLAY:-:0.0}" \ + -e USERNAME=yourusername \ + -e USERNAME=yourpassword \ + -e "OSX_COMMANDS=/bin/bash -c \"put your commands here\"" \ + sickcodes/docker-osx:naked-auto + +# Boots in a minute or two! + +``` + ### Further examples There's a myriad of other potential use cases that can work perfectly with Docker-OSX, some of which you'll see below! @@ -1258,23 +1333,6 @@ docker run \ newImageName ``` -#### Run Catalina Pre-Installed [![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) - -```bash -docker pull sickcodes/docker-osx:auto - -# boot directly into a real OS X shell with a visual display [NOT HEADLESS] -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 - -# username is user -# passsword is alpine -``` - ```bash docker pull sickcodes/docker-osx:auto From 5ca6529ae2d9a49e71d8e2381ab6e2e31ee1742e Mon Sep 17 00:00:00 2001 From: sickcodes Date: Thu, 26 Aug 2021 00:00:23 +0000 Subject: [PATCH 2/2] Add `sickcodes/docker-osx:naked-auto` to test.sh --- tests/test.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test.sh b/tests/test.sh index 2218921..3a11833 100644 --- a/tests/test.sh +++ b/tests/test.sh @@ -122,6 +122,7 @@ NO_CACHE="${NO_CACHE:=--no-cache}" TEST_BUILDS=( 'docker-osx:latest' 'docker-osx:naked' +'docker-osx:naked-auto' 'docker-osx:big-sur' 'docker-osx:auto' #'docker-osx:auto-big-sur' @@ -221,6 +222,16 @@ docker-osx:naked () { } +docker-osx:naked-auto () { + docker build ${NO_CACHE} \ + --build-arg RANKMIRRORS=true \ + --build-arg MIRROR_COUNTRY="${MIRROR_COUNTRY}" \ + -f ./Dockerfile.naked-auto \ + -t docker-osx:naked-auto . + docker tag docker-osx:naked-auto sickcodes/docker-osx:naked-auto +} + + docker-osx:big-sur () { docker build ${NO_CACHE} \ --build-arg VERSION=11 \ @@ -291,6 +302,7 @@ if [[ "${DOCKER_USERNAME}" ]] && [[ "${DOCKER_PASSWORD}" ]]; then && docker push sickcodes/docker-osx:latest \ && docker push sickcodes/docker-osx:big-sur \ && docker push sickcodes/docker-osx:naked \ + && docker push sickcodes/docker-osx:naked-auto \ && docker push sickcodes/docker-osx:auto \ && docker push sickcodes/docker-osx:auto-big-sur \ && touch PUSHED