Skip to content

Instantly share code, notes, and snippets.

@FlandreDaisuki
Forked from MarcinZukowski/X11-in-docker.md
Created November 17, 2024 15:04
Show Gist options
  • Save FlandreDaisuki/60a4adea4e8b54abb26a5d0f2cb090a7 to your computer and use it in GitHub Desktop.
Save FlandreDaisuki/60a4adea4e8b54abb26a5d0f2cb090a7 to your computer and use it in GitHub Desktop.
Making X work inside docker

Making X11 apps work inside docker

TL;DR

xhost +local:docker
docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix ...

Details

Every now and then I want to run X apps inside docker, and then I always hit some issues.

Here are all the options that might need to be set:

  • Allow docker to connect to X

xhost +local:docker

  • DISPLAY

pass into Docker with -e DISPLAY=$DISPLAY

  • X socket

share with Docker with -v /tmp/.X11-unix/:/tmp/.X11-unix

@FlandreDaisuki
Copy link
Author

set the --user also works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment