can't connect to X11 (Ubuntu 22.04.3 LTS)
Opened this issue · 8 comments
Failed to initialize graphics environment
java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
(base) utopiah@r15-desktop4090:~/Prototypes/android-studio-docker$ echo $DISPLAY
:0
with in compose.yml
having
# Mount the proper locationm for x11 server if you are running this in native linux
- /tmp/.X11-unix:/tmp/.X11-unix .
- android_studio:/androidstudio-data
environment:
- DISPLAY=:0 # Set DISPLAY environment variable
Same error on Ubuntu 23.10
I tried xhost +
or adding in $HOME/.bash_profile
JAVA_OPTIONS=-Djava.awt.headless=true
export JAVA_OPTIONS
but same result.
The error tells you that you can't connect to the display server.
Usually, the server listens on :0, but this could also be some other variable.
What does your shell (not inside docker!) DISPLAY environment variable say?
That's what I thought which is why I shared
echo $DISPLAY
:0
isn't it matching?
Not sure if it makes a difference in that case but I run docker here as a user, not as root.
Not sure if it makes a difference in that case but I run docker here as a user, not as root.
That should not make a difference.
Make sure you are running x11, not wayland mabe?
Maybe some problem with your .xauthority file not allowing access to the x11 server?
Sorry can't help here, I am also no display server expert.
Seems so :
fabien@fabien-CORSAIR-ONE-i160:~$ echo $XDG_SESSION_TYPE
x11
No worries I'll investigate https://stackoverflow.com/questions/44429394/x11-forwarding-of-a-gui-app-running-in-docker and report here!