andrewmackrodt/dockerfiles

how to use dockerfiles for dolphin emulator

jpcapone opened this issue · 11 comments

i figured cloning the https://github.com/andrewmackrodt/dockerfiles was the only way to grab the files for the dolphin emulator. At this point I am unsure of how to proceed. The emulator yml file does not expose any ports so i wouldn't know how to connect to it once its up and running. I can fumble through adding the games via mount points but before I do that I need to understand how to use the emulator. Just for the record I already have an nvidia gpu passed through the docker host so i am looking for direction in regards to using the dolphin emulator. Any suggestions would be appreciated, thanks!!
*** I figured out that i need to run Make (even though i have no idea what to do after that lol) but I get the error below:
[2022-28-06 03:10:55] dockermax.FATAL: no build.properties file(s)
make[1]: *** [../Makefile.mk:16: do-build] Error 255
make[1]: Leaving directory '/var/lib/docker/volumes/dolphin/dockerfiles/php'
make: *** [Makefile:3: build] Error 2

Please advise.

@jpcapone the X11 based images in this repository rely on the hosts X11 installation so no port is exposed to provide, for example, a VNC connection.

If you want to build your own dolphin image using the provided Dockerfile:

git clone https://github.com/andrewmackrodt/dockerfiles.git
cd dockerfiles/dolphin-emu-x11
./configure
make

However, the configure script will end up pulling the latest image from Dockerhub, so you can follow the instructions from https://github.com/andrewmackrodt/dockerfiles/tree/master/dolphin-emu-x11#docker to get running without having to build your own image. Images are built nightly and build logs are available at https://jenkins.mackrodt.io/job/dockerfiles/job/dolphin-emu-x11/.

The instructions from the README linked above will create a container called dolphin-emu which you can then start with docker start dolphin-emu; if you have an nvidia GPU, the first start may appear to not do anything for some time while the container tries to install a matching driver to what is available on the host, you can inspect the log output with docker logs -f dolphin-emu.

Alternatively, you can copy the docker-compose.yml file and then use docker-compose up if you have docker compose installed.

Lastly, if you are using nvidia-docker, rather than relying on the containers ability to try and match the driver version with that on the host, you can set the relevant configuration, e.g.

---
version: "2.1"

services:
  dolphin-emu:
    image: andrewmackrodt/dolphin-emu-x11
    network_mode: host
    runtime: nvidia
    security_opt:
      - apparmor:unconfined
    shm_size: 128M
    devices:
      - /dev/input
      - /dev/snd
    environment:
      # host UID/GID mapping
      - PUID=${UID:-1000}
      - PGID=${UID:-1000}
      # nvidia
      - NVIDIA_DRIVER_CAPABILITIES=all
      - NVIDIA_SKIP_DOWNLOAD=1
      - NVIDIA_VISIBLE_DEVICES=all
      # x11
      - DISPLAY=unix$DISPLAY
    volumes:
      # x11
      - /tmp/.X11-unix:/tmp/.X11-unix:ro
      # pulseaudio
      - /etc/machine-id:/etc/machine-id:ro
      - /run/user/${UID:-1000}/pulse:/run/user/${UID:-1000}/pulse:ro
      - $HOME/.config/pulse:/home/ubuntu/.config/pulse:ro
      # dbus
      - /run/user/${UID:-1000}/bus:/run/user/${UID:-1000}/bus:ro
      - /run/dbus:/run/dbus:ro
      - /run/udev/data:/run/udev/data:ro
      - /var/lib/dbus/machine-id:/var/lib/dbus/machine-id:ro
      # timezone (optional)
      - /etc/localtime:/etc/localtime:ro
      # dolphin-emu
      - $HOME/.dolphin-emu/Config:/config
      - $HOME/.dolphin-emu:/data
      - $HOME/Games/GameCube:/gc:ro
      - $HOME/Games/Wii:/wii:ro

Thanks for getting back to me. I chose to take on this task as a way to learn new things and thats exactly what is happening, LOL! So X11 was already installed on my host but i am connecting from windows so I had to install an app to allow for the X11 window to pop up. I did this and tested using xeyes successfully. now, when I attempt to docker compose the dolphin compose file i get this error: "qt.qpa.xcb: could not connect to display unixlocalhost:10.0
dolphin-emu-x11-dolphin-emu-1 | qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
dolphin-emu-x11-dolphin-emu-1 | This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem." I am researching this now but I would appreciate any input you may have.

The X11 images are primarily aimed for Docker Linux, Windows may work if using WSLG, but I'm not sure what level of OpenGL support that goes up to and whether Vulken renderer would work. Sound I'm not sure about and controller input won't work at it's not exposed via the Hyper-V VM used by Docker Windows.

I have a WSLG Windows install, I'll see if it's possible to get running at least. WSLG requires Windows 11.

Ok thanks for your insight. I am on windows 11 so i went ahead and installed wslg. the error is slightly different:
qt.qpa.xcb: could not connect to display unix
dolphin-emu-x11-dolphin-emu-1 | qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
dolphin-emu-x11-dolphin-emu-1 | This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
dolphin-emu-x11-dolphin-emu-1 |.
I am thinking that this entry in the docker compose file needs to be changed: - DISPLAY=unix$DISPLAY

I am gonna keep researching.
****** I had to set the $DISPLAY environmental variable now the error is "qt.qpa.xcb: could not connect to display unix127.0.0.53:0.0"
I edited the -DISPLAY setting in the docker compose file to remove unix from the docker compose file and the error is "qt.qpa.xcb: could not connect to display 127.0.0.53:0.0"
I guess that makes sense so I am still researching.

The minimal config I could come up with to passthrough my nvidia card to docker windows is:

docker run --rm \
  --device=/dev/dxg \
  --network=host \
  --shm-size "256M" \
  -e "DISPLAY=unix$DISPLAY" \
  -e "LD_LIBRARY_PATH=/usr/lib/wsl/lib" \
  -e "PULSE_SERVER=${PULSE_SERVER}" \
  -e "PUID=$(id -u)" \
  -e "PGID=$(id -g)" \
  -v "/mnt/wslg:/mnt/wslg:ro" \
  -v "/mnt/wslg/.X11-unix:/tmp/.X11-unix:ro" \
  -v "/usr/lib/wsl:/usr/lib/wsl:ro" \
  -v "$HOME/Games/GameCube:/gc:ro" \
  -v "$HOME/Games/Wii:/wii:ro" \
  andrewmackrodt/dolphin-emu-x11

Note that I have cuda support for wsl2 installed, I do not know if this is required: https://docs.nvidia.com/cuda/wsl-user-guide/index.html#getting-started-with-cuda-on-wsl

However, dolphin warns that the performance will be "terrible" and requires going in to the options and turning off on-screen display to hide the warning. I tried getting to the main menu of Metal Gear Solid: Twin Snakes and it did not render correctly, although the intro cutscene looked ok. Sound also works with the above config.

dolphin-emu-x11-wslg

You may need to explicitly export DISPLAY=:0 as you seem to have some override defaulting to 127.0.0.53:0.0.

Ah so in your testing is the docker host your windows machine? I have been using a remote Ubuntu host for testing. I will try it with a local docker host on windows.

I primarily run Linux but for the above test Windows was used as the docker host and client. It sounds like you are connecting to a remote Linux host using a Windows client? In that case, you can try the original config but remove the unix prefix for display as it seems like you may be using X11 forwarding. No WSLG is required if this is the case.

I have been using a windows client with a Linux host. I removed the unix prefix:
Unexpected authorization protocol.qt.qpa.xcb: could not connect to display localhost:10.0
xeyes is still working
still researching....
I previously used bitvise as my ssh client for the ubuntu docker host
I just used WSLG ubuntu session and was able to successfully run xeyes. I then ssh'd into the ubuntu docker host and I get this error
qt.qpa.xcb: could not connect to display
when attempting to run the dolphin-emu. the current environment setting for display is - DISPLAY=$DISPLAY in the docker compose file.
still researching....

Ok so I installed ubuntu on a laptop i have laying around. version 22.04. now the error i get is
could not connect to display unixlocalhost:11.0
xeyes works with no issue. any suggestions?

If the result of echo $DISPLAY does not start with a colon, you must exclude the unix prefix when passing the DISPLAY environment variable to docker as it contains a hostname/ip address.

When you used SSH from Windows to connect to your Ubuntu host, did you include -X as a parameter to ssh to enable X11 forwarding? You can then try running xeyes on the Ubuntu host you are connected to via SSH, rather than in your WSLG session.

If the above step works, dolphin will likely work with forwarding if we mount the .Xauthority folder, e.g. -v "$HOME/.Xauthority:/home/ubuntu/.Xauthority:rw.

Thank you for your assistance thus far. I think i am getting closer because now I get
X11 connection rejected because of wrong authentication
This is on my windows client using using wslg to connect to the ubuntu docker host.

From my fresh install of ubuntu desktop connecting to the same ubuntu docker host I get

X11 connection rejected because of wrong authentication.
dolphin-emu-x11-dolphin-emu-1  | qt.qpa.xcb: could not connect to display localhost:11.0

I am connecting with ssh -X user@ip_address
Also, echo $DISPLAY returns
localhost:11.0

Please provide any thoughts or suggestions you may have and I will continue to research these errors.

Fixed it!~!!! After reading your response it became clear that you provided the solution for the errors i was experiencing.
I added $HOME/.Xauthority:/home/ubuntu/.Xauthority:rw
to the docker compose file and now it works!!!
Just for the record this is from an ubuntu docker host with a tesla p4 passed thru. I am running on a windows 11 box using bitvise ssh client. I am gonna add some games and test it out. Thanks for all your help its really appreciated.