A Fedora based Docker image with Xfce4 and NoMachine which allows for local Virtual Machine equivalent graphical performance (as opposed to X11, VNC and RDP), accessing the desktop environment.
Also featured on https://dev.to/cmanique/docker-as-an-alternative-to-virtual-machines-for-transient-environments-that-require-a-gui-24la
DISCLAIMER: so far this has been tested on Windows 10 64bit host, which is the platform that lacks the most in terms of graphical connectivity to remote environments other than native remote desktop connections, or virtual machines working in seamless mode, that come at a great cost of storage space, and don't have the modular capabilities of docker.
I do have reasons to believe that if a display is already running on the host (ie: Linux, Mac), maybe NoMachine will show it instead. Needs investigation. I did test on headless remote Linux and it works just as fine (just slower due to network latency)
$ git clone https://github.com/cmanique/docker-fedora-xfce-nomachine.git
$ cd docker-fedora-xfce-nomachine
docker build -t fedora-xfce-nomachine .
$ docker pull cmanique/fedora-xfce-nomachine
$ docker run --cap-add=SYS_PTRACE -d -p 4000:4000 --name fedora-xfce-nomachine cmanique/fedora-xfce-nomachine
note the container needs to be run as a daemon (unless you want it to run privileged, and it's pointless because of the entrypoint)
$ docker exec -it fedora-xfce-nomachine bash
$ /usr/NX/bin/nxserver --startup
NX> 111 New connections to NoMachine server are enabled.
NX> 161 Enabled service: nxserver.
NX> 162 WARNING: Cannot find X servers running on this machine.
NX> 162 WARNING: A new virtual display will be created on demand.
NX> 161 Enabled service: nxd.
Open https://www.nomachine.com/download on your browser and download the appropriate installer (Windows, Mac, Linux)
Follow the instructions at https://www.nomachine.com/DT02O00124 in order to correctly install the software on your computer
for the time being the credentials are hard-coded on the Dockerfile as nomachine/nomachine
Tick Mute audio on the server while I'm connected, Don't show this message again for this connection, select the second icon on the bottom row in order to resize the remote display to your window and click OK
this case shows Red Hat CodeReady Studio, which was also installed through Docker, by having an image extending this one
$ docker stop fedora-xfce-nomachine