Skip to content

docker build with interactive GUI

Martin Viereck edited this page Jul 5, 2022 · 9 revisions

docker build with interactive GUI

Some applications need some interaction during installation. Often it is possible to avoid this with command line options or to work around with tools like echo, yes and expect. For cases where this is not possible, x11docker allows to run an interactive GUI during docker build. For example, installing Windows applications in wine often requires user interaction.

Example:

  • Dockerfile needs line ARG DISPLAY:
FROM x11docker/fvwm
ARG DISPLAY
RUN xterm
  • Run an X server and note the shown DISPLAY variable. Here it is DISPLAY=172.17.0.1:30:
$ x11docker --xephyr --printenv --xoverip --no-auth --display=30
 DISPLAY=172.17.0.1:30 XDG_RUNTIME_DIR=/run/user/1000
  • Build the docker image and provide DISPLAY. The X access also needs --network=host.
docker build --build-arg DISPLAY=172.17.0.1:30 --network=host [...]
  • Run your desired commands in the xterm window visible in X server Xephyr. Close xterm window or type exit when you are done.

screenshot

Clone this wiki locally