mviereck / x11docker

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

Non desktop GUI on host and x11docker for desktop emulation #20

Closed sandrokeil closed 6 years ago

sandrokeil commented 6 years ago

Thank you very much for this awesome project. It looks very promising. :+1:

Have you tried to use a non desktop Linux on host and automatically let start a desktop environment via x11docker on bootup? And then use this desktop container to start other applications like Google Chrome via x11docker on host?

I'm curious if this makes sense or should I use a desktop GUI on host to start other applications via x11docker? What do you think?

mviereck commented 6 years ago

Thank you very much for this awesome project. It looks very promising. :+1:

You are welcome, thanks for your feedback! :-)

It is possible to run x11docker on a non-desktop Linux. If you have a monitor and Xorg installed, you can run x11docker --desktop --xorg x11docker/xfce, for example. Without a monitor/on a server, you can run with option --xdummy or --xvfb and set up a network access as described in the Readme. (You can drop --xorg as x11docker will recognize it as only sense-making possibility).

For autostart I would have to look, just regular procedure with autologin on boot and x11docker command in .bashrc should work.

And then use this desktop container to start other applications like Google Chrome via x11docker on host?

I am not sure if I understand you right. You want to run the desktop in docker, but run applications from host on this desktop? That is possible, but I am not sure what that would be good for?

x11docker runs the X server on host. To run host applications on this X server, you need DISPLAY and XAUTHORITY. You can get them with

read xenv < <(x11docker --desktop --showenv x11docker/xfce)
env $xenv chromium

To avoid that ugly read, you can use option --display N to specify a display number and --no-auth to disable cookies.

x11docker --desktop --display 1 --no-auth x11docker/xfce
DISPLAY=:1 chromium

On the first glance, I am not sure if there is a comfortable way to start host applications from within docker. Maybe I will have an idea this evening.

Edit: I have an idea! You can run a panel from host that gives you access to host applications, for example lxpanel or xfce4-panel. Run it like I have described above for chromium.

sandrokeil commented 6 years ago

Thank you very much for your detailed explanation. My idea is to use a minimal linux "desktop" environment (e.g. ArchLinux without desktop GUI, only hardware driver + wayland + docker) and start every application via docker.

I am not sure if I understand you right. You want to run the desktop in docker, but run applications from host on this desktop? That is possible, but I am not sure what that would be good for?

Yes, I want to run a desktop GUI via Docker to get rid of the dependencies on the host. But I'm not sure if this make sense or is practicable.

I have an idea! You can run a panel from host that gives you access to host applications, for example lxpanel or xfce4-panel. Run it like I have described above for chromium.

Very interesting approach. I will try it but I guess it takes some weekends. ;-) I will give feedback.

mviereck commented 6 years ago

Yes, I want to run a desktop GUI via Docker to get rid of the dependencies on the host. But I'm not sure if this make sense or is practicable.

One major dependency for X applications is Xorg, and most x11docker options run X on host. But now I provide an alternative:

I've just published x11docker/xwayland that runs X server Xwayland in container. As a minimal dependency on host it needs weston without X/Xorg at all.

The image runs fvwm as a minimal window manager with desktop capabilities. Of course, you can install and run any other desktop environment with adjusting the dockerfile.

mviereck commented 6 years ago

I found that launchy integrates quite well in container desktops to start host applications. And I found a simple setup to create xsession entries for display managers, see #28.

mviereck commented 6 years ago

I had to make some bugfixes that prevented running host applications on x11docker/xwayland before. If you failed previously, please pull a fresh image from docker hub and regard the setup described in the Readme of x11docker/xwayland.