I have seen 2 discussions on this, one is on CentOS
which involves installing “xeyes”. However, this is not a valid package for debian-based systems and the author does not respond so I don’t know how to proceed.
Another discussion is by Jessie
she provides examples but does not explain exactly what is necessary to enable GUIs. No mention of ‘xeyes’ or an equivalent.
is adding -e DISPLAY=unix$DISPLAY all that’s needed to get a GUI? If so, how do I specify when a GUI window appears? There are other apps in my container that do not require a GUI, what happens then?
-v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
-e DISPLAY=unix$DISPLAY \ # pass the display
--device /dev/snd \ # sound
The -v bind makes the x11 unix domain socket available in the container.
The -e environment parameters tells the container which display to use (using the unix domain socket).
The `–device’ param enables to use the soundcard inside the container.
The application inside the container passes the output of DISPLAY in the unix domain socket - the x11 server on your host reads the information from the unix domain socket and renders it on your screen.
Everything looks fine so far, except the “unix” in front of unix$DISPLAY. I don’t remember ever having the string literal unix in from of $DISPLAY.
Update: I used to run a containerized eclipse inside a container and i had to run xhost +local:$(id -un) on the host before the continer was started in order to make the xserver to accept the connection. Though, I did start the container with -u $(id -un), so the process inside the container was started from the same user id… not sure if it’s relevant - though, high likely it is
Is there anything needed in the dockerfile (e.g. apt install and/or configure anything) to get the GUI?
I tested this on the official debian image, got this error
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"-v\": executable file not found in $PATH": unknown.
tried xhost +local:$(id -un) on the host too, still the same error.