Skip to content

Instantly share code, notes, and snippets.

@MarcinZukowski
Last active January 22, 2024 04:53
Show Gist options
  • Save MarcinZukowski/ecea29823907df3386c2cac7b56e0385 to your computer and use it in GitHub Desktop.
Save MarcinZukowski/ecea29823907df3386c2cac7b56e0385 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

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