Docker containers provide isolation, for process. Well rendering UI is also a process. The blocker is, docker container images do not have the necessary drivers and hardware access to interact with the display device. To be specific, running an "Xorg" server is (inhumanely)impossible in docker.
Hence, to render UI from docker, like below, we have to do someting like x11(xorg server) forwarding, like in ssh -x
- Nested Xserver: Xephyr
- Run with following configuration
-
Xephyr -ac -noreset -dpi 96 -resizeable -noxv -screen 1504x804 -keybd ephyr,,,xkbmodel=evdev :8 -listen tcp -retro +extension RANDR +extension RENDER +extension GLX +extension XVideo +extension DOUBLE-BUFFER +extension SECURITY +extension DAMAGE +extension X-Resource -extension XINERAMA -xinerama -extension MIT-SHM +extension Composite +extension COMPOSITE -extension XTEST -tst -dpms -s off
-
- Run with following configuration
- The lightmachine docker image,
-
docker run --rm -ti --init \ --cap-add NET_ADMIN --cap-add NET_RAW --init\ -e DOCKERGROUP=$(getent group docker | awk -F : '{ print $3 }') \ -e RENDERGROUP=$(getent group render | awk -F : '{ print $3 }') \ --ipc=host\ -e DISPLAY="128.0.0.1:8" -e PULSE_SINK=audio_jack3 -e PULSE_SERVER=tcp:128.0.0.1:12322 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /shared/pkv/d:/shared/velcrine/d \ -v /shared/pkv/l:/shared/velcrine/l \ -v /shared/pkv/p:/shared/velcrine/p:ro \ -v /shared/pkv/r:/shared/velcrine/r \ -v /shared/pkv/h/envoy:/home/ \ --hostname lxqt \ -e USERNAME=velcrine \ -e PASSWORD=ok \ velcrine/envoy:latest
-
One Dockerfile, built with --build-arg DESKTOP_ENV= gnome3 | lxde | mate | node will produce respective docker image.
docker build . -t velcrine/debian_lxde --build-arg DESKTOP_ENV=lxde
I highly recommend go through the build process and make your own customizations for your own flavour.
-
--build-arg DESKTOP_ENV=lxde
: to producevelcrine/debian_lxde
which is based on "lxde" desktop environment -
--build-arg DESKTOP_ENV=gnome3
: to producevelcrine/debian_gnome3
which is based on "gnome3" desktop environment -
--build-arg DESKTOP_ENV=mate
: to producevelcrine/debian_mate
which is based on "mate" desktop environment -
--build-arg DESKTOP_ENV=node
: to producevelcrine/debian_node
which is based on "no desktop environment"(node).Node comes with a user named "debug", password " " and uid 9998 to begin with.
-
Add a shell script to be run (kind of as an entrypoint) before the desktop environment starts like this
-v /path/to/file.sh:/dockerstation/init.sh
. Now this shell script will run before the desktop environment starts. -
Use these images as base image for extending them with your application or your configuration. See
/instance
directory for live example.