2022-01-30 - X11 forwarding to docker container

sometime ago i had an issue with X11 forwarding for containers. for quite some time i just used setup SSHd in container and X11 forward via SSH. later on things improved. in fact my steam containerization efforts did use that approach, yet it was not exposed, so maybe it would be good to point it out explicitly.

the spell is:

docker run \
  -it \
  -rm \
  -u "$(id -u):$(id -g)" \
  -e DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  "your_image_with_x11_app"

so the key thing is to forward DISPLAY variable and path to X11 socket file. simple and straight forward… once you spent enough time on the net googling for quirks. ;)

btw: for QT-based applications you may also want to pass -e QT_X11_NO_MITSHM=1, to disabled shared memory usage.

blog/2022/01/30/2022-01-30_-_x11_forwarding_to_docker_container.txt · Last modified: 2022/01/30 20:21 by basz
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0