Skip to content

Instantly share code, notes, and snippets.

@bikcrum
Created January 9, 2026 00:42
Show Gist options
  • Select an option

  • Save bikcrum/27254de8c4bf212de899cca6e49aff37 to your computer and use it in GitHub Desktop.

Select an option

Save bikcrum/27254de8c4bf212de899cca6e49aff37 to your computer and use it in GitHub Desktop.
How to change display dynamically in the docker container? For example, host display changes upon reboot.
# Inside the container, edit /root/.bashrc and add this at the very bottom:
# --- Fix DISPLAY for IDE-attached shells ---
# Prefer the newest X socket (usually the active desktop)
for d in /tmp/.X11-unix/X*; do
n="${d##*/X}"
export DISPLAY=":$n"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment