Docker-OSX!

pull/9/head
name 5 years ago
parent 6d50dd6fb8
commit 15bf6f26be

@ -0,0 +1,94 @@
#/usr/bin/docker
# ____ __ ____ ______ __
# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ /
# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| /
# / /_/ / /_/ / /__/ ,< / __/ / / /_/ /___/ / |
# /_____/\____/\___/_/|_|\___/_/ \____//____/_/|_|
#
# Title: Mac on Docker (Docker-OSX)
# Author: Sick.Codes https://sick.codes/
# Credits: Kholia https://github.com/kholia/osx-kvm
# Version: 1.0
# License: GPLv3
#
# All credits for OpenCore support go to https://github.com/Leoyzen/KVM-Opencore and
# https://github.com/thenickdude/KVM-Opencore/. Thanks!
#
# This Dockerfile automates the installation of Docker-OSX
# It will build a 32GB Mojave Disk, you can change the size using build arguments.
# This file builds on top of the work done by Dhiru Kholia and many others.
#
# Build:
#
# docker build -t docker-osx .
#
# docker build -t docker-osx --build-arg VERSION=10.14.6 --build-arg SIZE=200G
#
# Run:
#
# docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix docker-osx
#
FROM archlinux:latest
MAINTAINER 'https://sick.codes' <https://sick.codes>
# change disk size here or add during build, e.g. --build-arg VERSION=10.14.6 --build-arg SIZE=50G
ARG SIZE=32G
ARG VERSION=10.14.6
RUN [[ $(egrep -c '(svm|vmx)' /proc/cpuinfo) -gt 0 ]] || { echo KVM not possible on this host && exit 1; }
WORKDIR /root
RUN tee -a /etc/pacman.conf <<< '[community-testing]'
RUN tee -a /etc/pacman.conf <<< 'Include = /etc/pacman.d/mirrorlist'
RUN pacman -Syu --noconfirm
RUN pacman -S sudo git make automake gcc python go autoconf cmake pkgconf alsa-utils fakeroot --noconfirm
RUN useradd arch
RUN echo 'arch ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
RUN mkdir /home/arch
RUN chown arch:arch /home/arch
USER arch
WORKDIR /home/arch
RUN git clone https://aur.archlinux.org/yay.git
WORKDIR /home/arch/yay
RUN makepkg -si --noconfirm
WORKDIR /home/arch
RUN git clone https://github.com/corpnewt/gibMacOS.git
WORKDIR /home/arch/gibMacOS
RUN perl -p -i -e 's/print("Succeeded:")/exit()/' ./gibMacOS.command
# this command takes a while!
RUN python gibMacOS.command -v "${VERSION}" || echo Done
RUN sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison ebtables edk2-ovmf --noconfirm
RUN sudo systemctl enable libvirtd.service
RUN sudo systemctl enable virtlogd.service
WORKDIR /home/arch
RUN git clone https://github.com/kholia/OSX-KVM.git
RUN sudo pacman -Syu netctl libvirt-dbus libguestfs --noconfirm
WORKDIR /home/arch/OSX-KVM
RUN sed -i -e 's/usb-mouse/usb-tablet/g' OpenCore-Boot.sh
RUN chmod +x OpenCore-Boot.sh
WORKDIR /home/arch/OSX-KVM
RUN qemu-img convert ${HOME}/gibMacOS/macOS\ Downloads/publicrelease/*/BaseSystem.dmg -O raw ${HOME}/OSX-KVM/BaseSystem.img
RUN qemu-img create -f qcow2 mac_hdd_ng.img "${SIZE}"
RUN perl -p -i -e \
's/-netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27/-netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:09:49:17/' \
./OpenCore-Boot.sh
ENV DISPLAY :0.0
ENV USER arch
USER arch
VOLUME ["/tmp/.X11-unix"]
CMD ./OpenCore-Boot.sh

@ -1,2 +1,42 @@
# Docker-OSX
Mac in Docker! Run near native OSX-KVM in Docker! X11 Forwarding!
![Running mac osx in a docker container](/running-mac-inside-docker-qemu.png?raw=true "OSX KVM DOCKER")
Run Mac in a Docker container! Run near native OSX-KVM in Docker! X11 Forwarding!
Author: Sick.Codes https://sick.codes/
Credits: OSX-KVM project among many others: https://github.com/kholia/OSX-KVM/blob/master/CREDITS.md
```
docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx:latest
```
# Instant OSX-KVM in a BOX!
This Dockerfile automates the installation of OSX-KVM inside a docker container.
It will build a 32GB Mojave Disk.
You can change the size and version using build arguments (see below).
This file builds on top of the work done by Dhiru Kholia and many others on the OSX-KVM project.
# Custom Build
```
git clone https://github.com/sickcodes/Docker-OSX.git
cd Docker-OSX
docker build -t docker-osx:latest \
--build-arg VERSION=10.14.6 \
--build-arg SIZE=200G
docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx:latest
```
## Todo:
```
# persistent disk with least amount of pre-build errands.
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

Loading…
Cancel
Save