mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

Idea: Using x11docker as a sort of display manager for multiple DEs #28

Closed Greenscreener closed 6 years ago

Greenscreener commented 6 years ago

Installing multiple desktop environments is a challenging and on some OSes an even impossible task. What if you could install and run the DEs from x11docker? (Instead of like, IDK sddm or lightdm)(Is that even possible?) This would unlock many possibilities like multiple DEs at once! (Not sure why would anyone want that, but it at least sounds cool.)

mviereck commented 6 years ago

I thought a bit about this, but I fear it is a lot of work for only few real use cases. I am not sure if there is already a display manager that can handle multiple X sessions; than that one culd be used.

It is already possible to start multiple desktop sessions on several ttys with x11docker. Just switch e.g. to tty2 with and run x11docker, then do the same on other ttys.


To start host applications inside the dockered desktop you need some sort of panel or launcher. I found that launchy integrates well. To start launchy from host on x11docker display:

read Xenv < <(x11docker --desktop --showenv x11docker/lxde)
env $Xenv launchy

launchy can be started from systray in container desktop or with <ctrl><space>. It needs a bit configuration to read /usr/bin from host, otherwise it only displays entries in /usr/share/applications.


It is possible to create an entry for display managers with an x11docker session. Example: Create a script /usr/local/bin/x11docker-lxde.sh and make it executeable with chmod +x:

#! /bin/bash
launchy &
x11docker --hostdisplay x11docker/lxde

The display manager sets up an X server and x11docker uses that one with --hostdisplay. Create an entry for display managers /usr/share/xsessions/x11docker-lxde.desktop:

[Desktop Entry]
Name=LXDE x11docker
Comment=LXDE desktop in a docker container
Exec=/usr/local/bin/x11docker-lxde.sh
Terminal=false
Type=Application

Although you can run a desktop in docker and start host applications in it, you will miss some things. For example, if you plug in an USB stick, the desktop will not recognize it. Or if you use a file manager from container and double-click a video, it will not open a video player that is installed on host.

But if you accept those drawbacks, you get the advantage to choose between several desktop environments without flooding your host system.

Also you have the possibility to drop Xorg on host at all. With only weston installed on host, you can run Xwayland in docker. Compare image x11docker/xwayland and ticket #20.