top | item 28420828

Run GUI applications and desktops in Docker

90 points| majkinetor | 4 years ago |github.com | reply

18 comments

order
[+] mg|4 years ago|reply
I was curious to read the script but woah, it is over 9000 lines.

It probably has a lot of security and convenience functionality.

A minimal approach to run graphical applications inside a Docker container is this one-liner:

docker run -it --rm -e DISPLAY --net=host -v $XAUTHORITY:/root/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix debian:11-slim

Then inside the container, run:

    apt update
    apt install firefox-esr
    firefox
Now Firefox runs inside the container and you can use it.
[+] nextaccountic|4 years ago|reply
> It probably has a lot of security and convenience functionality.

A shell script with 9000 lines probably has a lot of security issues..

[+] encryptluks2|4 years ago|reply
While I think it is great to explore using containers for isolate desktop apps, that is my understanding of what tools like Flatpak and snapd does already. I'd love to see them implemented into the standard container ecosystem though. However, this is limited to Xorg (which is fine for most applications), however there is growing native support for Wayland.
[+] Arnavion|4 years ago|reply
>However, this is limited to Xorg (which is fine for most applications), however there is growing native support for Wayland.

The principle of nesting Xephyr inside the host X server easily extends to nesting cage or sway or weston inside the host's wayland compositor.

[+] mviereck|4 years ago|reply
x11docker supports Wayland, too. It can directly pass Wayland access from host to containers, or run containered Wayland applications on host X using a nested Weston window. With the help of xpra it can run X application in container on a pure Wayland host.
[+] konsumer|4 years ago|reply
I made this to contain a bunch of graphical apps used for gameboy-development: https://github.com/konsumer/docker-gb-dev

It has wine and some old windows-only apps. I took a different approach, and used a VNC server. Not quite as fast, but doesn't require the host to have an Xserver. I even include a little web-based VNC client, so no install is needed.

[+] gravypod|4 years ago|reply
Is there anyway to pass exclusive access to a physical display to a docker container? I've been wanting to have this for a status display on some home servers.
[+] splittingTimes|4 years ago|reply
Can it run & render openGL contexts as well?
[+] Jnr|4 years ago|reply
Yes, you can pass graphics card to the container. I used to run Steam games in LXC containers.