I’m trying to use the Hub in a docker container. Here is the image Dockerfile:
FROM ubuntu:16.04
WORKDIR /tmp
COPY UnityHub.AppImage .
RUN chmod +x UnityHub.AppImage
RUN apt-get -qq update && apt-get -qq install -y --no-install-recommends apt-utils && apt-get -qq install -y \
fuse \
xdg-utils \
desktop-file-utils \
zenity \
xvfb \
&& apt-get clean
I run the image like this:
docker run --rm -it --cap-add SYS_ADMIN --device /dev/fuse unityhubdocker:1.0 bash
(the SYS_ADMIN and fuse device are so the AppImage works)
If I try to start the Hub:
/tmp/UnityHub.AppImage -- --headless help
This is the output:
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
(zenity:243): Gtk-WARNING **: cannot open display:
So it can’t connect to the display, which I was hoping I wouldn’t need. (since there is no display and this is headless mode)
This can be worked around by using xvbf but I wish I didn’t have to.
So now the command is this:
xvfb-run -a --error-file /var/log/xvfb_error.log --server-args="-screen 0 1024x768x24 +extension RANDR" /tmp/UnityHub.AppImage -- --headless help
This starts successfully - cool!
Unfortunately it just sits. Let’s see what is running in the container:
$ docker top 8ff3edbb5b73
PID USER TIME COMMAND
16472 root 0:00 bash
16757 root 0:00 {xvfb-run} /bin/sh /usr/bin/xvfb-run -a --error-file /var/log/xvfb_error.log --server-args=-screen 0 1024x768x24 +extension RANDR /tmp/UnityHub.AppImage -- --headless help
16769 root 0:00 Xvfb :99 -screen 0 1024x768x24 +extension RANDR -nolisten tcp -auth /tmp/xvfb-run.fTxaoN/Xauthority
16780 root 0:00 {AppRun} /bin/bash /tmp/.mount_UnityHYyu2ki/AppRun -- --headless help
16783 root 0:00 /tmp/UnityHub.AppImage -- --headless help
16790 root 0:00 zenity --text-info --title=Unity Hub --filename=/tmp/.mount_UnityHYyu2ki/eula.txt --ok-label=Agree --cancel-label=Disagree
It looks like we are waiting for a zenity dialog.
I would really like to agree but I don’t know how. Any tips on what I can do for now to get past this? (can I manually set a value on-disk to say I have agreed or something?)
TLDR:
- Make headless mode not require a display.
- Show the agree/disagree prompt in the CLI if using headless mode. (and don’t hang on UIs when in headless mode) Allow us to pipe ‘yes’ to automate the process.