Docker-OSX icon indicating copy to clipboard operation
Docker-OSX copied to clipboard

Can't run OS X inside of OS X

Open tibbon opened this issue 4 years ago • 36 comments

No host support it seems

docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx
Unable to init server: Could not connect: Connection refused
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

tibbon avatar Jun 05 '20 02:06 tibbon

matryoshka forbidden.

kongminhao avatar Jun 05 '20 07:06 kongminhao

It probably won't be possible to run it on macOS as Docker for Mac is actually running a tiny Linux VM with Docker inside, so the "matryoshka" would even be deeper.

suda avatar Jun 05 '20 09:06 suda

No host support it seems

docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx
Unable to init server: Could not connect: Connection refused
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

Try this:

echo $DISPLAY

# ARCH
sudo pacman -S xorg-xhost

# UBUNTU DEBIAN
sudo apt install x11-xserver-utils

# CENTOS RHEL FEDORA
sudo yum install xorg-x11-server-utils

# then run
xhost +

docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx ./OpenCore-Boot.sh

sickcodes avatar Jun 05 '20 11:06 sickcodes

I can put up VNC version if you want, the original I had was VNC before I saw how someone else did the x11 fowarding

sickcodes avatar Jun 05 '20 17:06 sickcodes

I can put up VNC version if you want, the original I had was VNC before I saw how someone else did the x11 fowarding

It would be awesome for running macOS Server on a headless server.

romancin avatar Jun 05 '20 18:06 romancin

Got it ready, will post in about three hours 😎

sickcodes avatar Jun 06 '20 12:06 sickcodes

https://github.com/sickcodes/Docker-OSX/tree/master/vnc-version

sickcodes avatar Jun 07 '20 01:06 sickcodes

Awesome, thank you!!!! I was almost just asking for a joke, but it does seem useful now that I think of it!

tibbon avatar Jun 07 '20 14:06 tibbon

You’re welcome, just promise to show us a screenshot once you get it running :)!

sickcodes avatar Jun 07 '20 17:06 sickcodes

Let us know if it worked guys :)

sickcodes avatar Jun 07 '20 22:06 sickcodes

Leaving this open until someone confirms

matryoshka

sickcodes avatar Jun 10 '20 09:06 sickcodes

Hmm, I'm getting this error now. Perhaps I'm just doing it wrong?

docker build -t local/docker-osx .
Sending build context to Docker daemon   5.12kB
Step 1/16 : FROM sickcodes/docker-osx:latest
 ---> 330edd24b7ee
Step 2/16 : MAINTAINER 'https://sick.codes' <https://sick.codes>
 ---> Using cache
 ---> 1f9a28c49b1a
Step 3/16 : USER arch
 ---> Using cache
 ---> b3064897f87d
Step 4/16 : RUN sudo pacman -S tigervnc xterm xorg-xhost xdotool ufw --noconfirm
 ---> Using cache
 ---> 3a7f37b66d2d
Step 5/16 : RUN mkdir ${HOME}/.vnc
 ---> Using cache
 ---> c089588609b7
Step 6/16 : RUN printf '%s\n' 'xinit &' 'xterm &' > ~/.vnc/xstartup
 ---> Using cache
 ---> 1b2648e8f176
Step 7/16 : RUN printf '%s\n%s\n%s\n\n' 'export DISPLAY=:99' 'vncserver -kill :99 || true' 'vncserver -geometry 1920x1080 -depth ${DEPTH:=24} -xstartup ~/.vnc/xstartup :99' > vnc.sh
 ---> Using cache
 ---> 89deedc7bcb6
Step 8/16 : RUN cat vnc.sh OpenCore-Boot.sh > OpenCore-Boot_custom.sh
 ---> Using cache
 ---> e21a17a07243
Step 9/16 : RUN chmod +x OpenCore-Boot_custom.sh
 ---> Using cache
 ---> b4f13ef4a4c1
Step 10/16 : RUN tee vncpasswd_file <<< "${VNC_PASSWORD:=$(openssl rand -hex 4)}"
 ---> Using cache
 ---> e7b48d1a15ef
Step 11/16 : RUN vncpasswd -f < vncpasswd_file > ${HOME}/.vnc/passwd
 ---> Using cache
 ---> 266c4cc51c58
Step 12/16 : RUN chmod 600 ~/.vnc/passwd
 ---> Using cache
 ---> af74e65141be
Step 13/16 : RUN printf '\n\n\n\n%s\n%s\n\n\n\n' '===========VNC_PASSWORD========== ' "$(<vncpasswd_file)"
 ---> Using cache
 ---> 93b5440515eb
Step 14/16 : WORKDIR /home/arch/OSX-KVM
 ---> Using cache
 ---> 6aca647168a0
Step 15/16 : USER arch
 ---> Using cache
 ---> 1ab163ce8287
Step 16/16 : CMD ./OpenCore-Boot_custom.sh
 ---> Using cache
 ---> fca260b8ecbf
Successfully built fca260b8ecbf
Successfully tagged local/docker-osx:latest
me@mymac vnc-version % docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix local/docker-osx ./OpenCore-Boot.sh
Unable to init server: Could not connect: Connection refused
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

I did a brew install qemu but I don't think that's my issue?

I also tried:

me@mymac vnc-version % docker run local/docker-osx

Can't find file /home/arch/.vnc/24a99c353255:99.pid
You'll have to kill the Xvnc process manually

xauth:  file /home/arch/.Xauthority does not exist

New '24a99c353255:99 (arch)' desktop is 24a99c353255:99

Creating default config /home/arch/.vnc/config
Starting applications specified in /home/arch/.vnc/xstartup
Log file is /home/arch/.vnc/24a99c353255:99.log

Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

tibbon avatar Jun 10 '20 15:06 tibbon

Noted, if anyone has had success with this issue, would be great to hear :) I will try test it later today

sickcodes avatar Jun 14 '20 14:06 sickcodes

echo $DISPLAY
/private/tmp/com.apple.launchd.lWN3QYe0Ym/org.macosforge.xquartz:0

I get a similar output on OS X 10.15.5.
docker for mac desktop version 2.3.0.3 docker version 19.03.8

docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix cmosetick/docker-osx:vnc-version
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519

Can't find file /home/arch/.vnc/3a2312c0264b:99.pid
You'll have to kill the Xvnc process manually


Warning: 3a2312c0264b:99 is taken because of /tmp/.X11-unix/X99
Remove this file if there is no X server 3a2312c0264b:99
A VNC server is already running as :99
Unable to init server: Could not connect: Connection refused
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

cmosetick avatar Jun 16 '20 18:06 cmosetick

Try

-e DISPLAY=:0

sickcodes avatar Jun 20 '20 11:06 sickcodes

But that’s for the X11 version. Don’t use display for the VNC version. Use the instructions in the top of the Dockerfile for VNC


# Build:
#
#       # write down the password at the end
#       docker build -t docker-osx-vnc .
# 
# Run:
#       
#       docker run -p 8888:5999 -p 50922:10022 -d --privileged docker-osx-vnc:latest
#
#
# Connect locally (safe):
#
#       VNC Host:     localhost:8888


sickcodes avatar Jun 20 '20 11:06 sickcodes

emmmmm..... i want to know the result. i have this same issue.

shuangwei-Ye avatar Jun 28 '20 02:06 shuangwei-Ye

ARCH

but...are these linux version? ARCH \centos \ UBUNTU. how to use this instruction in Mac os ?

shuangwei-Ye avatar Jun 28 '20 02:06 shuangwei-Ye

ARCH

but...are these linux version? ARCH \centos \ UBUNTU. how to use this instruction in Mac os ?

This is a Dockerfile, so you'd need Docker first: https://docs.docker.com/engine/install/

sickcodes avatar Jul 04 '20 17:07 sickcodes

ARCH

but...are these linux version? ARCH \centos \ UBUNTU. how to use this instruction in Mac os ?

This is a Dockerfile, so you'd need Docker first: https://docs.docker.com/engine/install/

I've already downloaded Docker Desktop for Mac (macOS), then run this project.

now I got the same result as tibbon

Unable to init server: Could not connect: Connection refused
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory

I wonder if Mac can run a Docker-OSX~

thanks

shuangwei-Ye avatar Jul 14 '20 01:07 shuangwei-Ye

I was able to build using docker-osx:vnc-version and launch with the suggested options in the script (docker run -p 8888:5999 -p 50922:10022 -d --privileged <dockerBuildImageValue>).

I am seeing the following when logging in via macOS built in Screen Sharing (and Real VNC) using the randomly generated VNC password: Screen Shot 2020-10-01 at 3 09 23 PM

When I try to click on the Recovery Drive to install macOS, I get the following kernel panic: Screen Shot 2020-10-01 at 3 15 08 PM

I am using Portainer (1.24.1) to manage Docker Desktop (2.4.0.0 build 48506) with brew QEMU (5.1.0) on MacOS 10.15.7.

This looks like it's somewhat working, up until the kernel panic's. Is there anything else I can grab to debug this?

drewdrew21b avatar Oct 01 '20 21:10 drewdrew21b

@drewdrew21b thats pretty close!

I'm not sure, I will try in a Docker-OSX to replicate this tomorrow so we can get the true full circle: OSX in OSX

You can try building the main image And then using that image in the VNC script (change FROM to your build)

sickcodes avatar Oct 01 '20 23:10 sickcodes

@sickcodes I tried to create a build on my MacBook Pro and Mac Mini and am getting what appears to be the same crash in both instances from macOS recovery when booting the recovery kernel.

drewdrew21b avatar Oct 02 '20 04:10 drewdrew21b

Any updates on that? The OSX in OSX feature would be really useful.

majest avatar Oct 14 '20 08:10 majest

Unfortunately I can't test it

sickcodes avatar Oct 14 '20 22:10 sickcodes

Same issue for me. Thanks for making this, though! Screen Shot 2020-10-20 at 12 43 26 PM

gitpushdashf avatar Oct 20 '20 18:10 gitpushdashf

I get the same issue as gitpushdashf. (Is there a common emoji reaction for "this happens to me, too"?)

adamwolf avatar Apr 05 '21 18:04 adamwolf

MacOSX doesn't have KVM, KVM is Linux only, the project relies on KVM, therefore it can't run on MacOSX

esnosy avatar Apr 07 '21 15:04 esnosy

You can run without it KVM on any platform.

I did it before, using OSX-KVM on a raspberry Pi.

A few command changes are needed I'll try and find the bash history. I would've saved it.

Also, don't when I did it on a RPI, I never got past the Apple Logo. Maybe because the SD card is exponentially slower than an SSD.

Don't forget the disk is large and needs more a bit of ram.

The Dockerfile is not multiarch. You can tell because we have some x86 patches.

It's 100% possible.

sickcodes avatar Apr 18 '21 19:04 sickcodes

I really wanted to make matryoshka happen, but for now it seems I need to stick with https://github.com/myspaghetti/macos-virtualbox when on a MacOS host and Docker-OSX when on *nix.

This is how I ran it and got as far as the others:

  • From the security tab in the XQuartz preferences, make sure Allow connections from network clients is enabled. Restart XQuartz after enabling it if it wasn't.
xhost +localhost
docker run --privileged -e DISPLAY=host.docker.internal:0 sickcodes/docker-osx

deepio avatar Apr 18 '21 20:04 deepio