Hi,

Last week I spent my learning time with Docker, I was curious how to
run an X application (an YaST module :-)) inside a Docker container
and display the UI in the local X server.


It turned out to be quite complicated, there are mainly these problems:

1) The Docker images are usually small and contain just a minimal system,
   the X libraries and other parts (like fonts) are usually missing.

   You have to install all that missing parts manually.

2) To access the local X server you need to set the $DISPLAY env. variable
   in the container and allow accessing the local X socket file (remote access 
via
   a TCP port is usually disabled for security reasons). Also you need to pass
   the .Xauthority file with the access token.

   Fortunately that's quite easy with Docker volumes which are basically
   bind mounts from the host system to inside the container.


My goal was to run the widget-demo [1] in graphical mode easily inside a 
container.

The result is a helper script [2] which builds a Docker image [3] with 
additional X
packages and runs the container with extra options which allow accessing the 
local X
server.


So if you ever need to run an X application inside a Docker container check 
this demo
package!


HTH

Ladislav


[1] https://github.com/yast/yast-widget-demo
[2] https://github.com/yast/yast-widget-demo/blob/master/docker/run.sh
[3] https://github.com/yast/yast-widget-demo/blob/master/docker/Dockerfile


-- 
Ladislav Slezák
YaST Developer

SUSE LINUX, s.r.o.
Corso IIa
Křižíkova 148/34
18600 Praha 8

Reply via email to