Error: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable

I started docker container using:

docker run --privileged -it wexac/testimage:v1 /bin/bash -il
The base image is “centos”

Then in the container shell, I need to run a ./ for a application, which requires GUI. the guide says I run it as:
“export DISPLAY=display_server_host_name:0.0

The error I got is: Starting First Steps.
Exception in thread “main” java.awt.AWTError: Can’t connect to X11 window server using ‘localhost:0.0’ as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(
at sun.awt.X11GraphicsEnvironment$
at sun.awt.X11GraphicsEnvironment.(
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(
at java.awt.GraphicsEnvironment.createGE(
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(

I then run
yum groupinstall “GNOME Desktop” "Graphical Administration Tools"
to install xOrg

But “startx” throws error:
Fatal server error:
(EE) no screens found(EE)

How can I start the xServer in docker container, so that I can run “./” for the application?



I’m have same problem… I was awaiting solution…
I have macbook pro with Intel Iris 1536 MB video card
I use XQuartz with socat. firefox running ok, but startx command got error same you.

The following finally worked for me. apparently cigwin/X was not working, and also I needed the actual IP address of my windows host.
Run GUI app in linux docker container on windows host - DEV Community