Search code examples
dockerserverdesktopheadlessx11-forwarding

Is it possible to run a docker container embedding a GUI environment on a GUI-less server and open the GUI session from a remote GUI client?


I have a GUI-less server (fresh Debian without any desktop environment or Ubuntu server, without X server, a priori). I consider to install docker and pull an official Ubuntu based container and add a desktop environment on it in order to use regular GUI apps.

I have a second computer in the LAN with a regular Debian Xfce or Xubuntu.

Is it possible to use this second computer to open the desktop session of the container (which is run on the GUI-less server) ? (I would like to use standard Debian or Ubuntu packages as much as possible and avoid to use external PPA packages)

Small state of the art :

  • I have seen the NoMachine solution : Build and Deploy NoMachine Desktops and Applications in Docker for Linux https://www.nomachine.com/DT10O00161

    • My problem is that it is not explicit whether the docker is run on a GUI or GUI-less host. (And I would prefer to use a package from the Debian or Ubuntu repositories)
  • I have also seen the Consol docker images like : consol/ubuntu-xfce-vnc https://hub.docker.com/r/consol/ubuntu-xfce-vnc/

    • I am not sure but they also seem to run in a GUI-based environment.
  • I also have seen a solution using Xvfb and x11vnc (sorry it is a french webpage but I expect the translation to be ok with regular onlie tools) : Utiliser VNC comme interface graphique avec un conteneur docker https://www.geeketfier.fr/post/docker-display-on-windows/

    • This one also, I am not sure but this solution seems also be running on a GUI-based environment.

Solution

  • I found this docker image which solves my question : docker-x2go-xubuntu : https://hub.docker.com/r/paimpozhil/docker-x2go-xubuntu

    I built it on the GUI-less server and ran it as explained on docker hub.

    On my second computer I opened an ssh tunnel to the GUIless server pointing to the docker interface :

    ssh -CY -L 33333:container.docker.ip:2222 -l guilessuserlogin guiless.server.ip
    

    (I retrieved the container IP by ifconfig on the GUIless server)

    On this second computer I installed x2goclient from the regular repositories and configured a session to connect to localhost:33333

    Once connected, the GUI desktop of the docker machine is completely available.