docker-intellij icon indicating copy to clipboard operation
docker-intellij copied to clipboard

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

Open breandan opened this issue 7 years ago • 1 comments

I received the following error when running dlsniper/docker-intellij according to the readme:

$ docker run -ti \
           --net="host" \
           --privileged=true \
           -e DISPLAY=${DISPLAY} \
           -v /tmp/.X11-unix:/tmp/.X11-unix \
           -v ${HOME}/.IdeaIC2016.1_docker:/home/developer/.IdeaIC2016.1 \
           -v ${GOPATH}:/home/developer/go \
           dlsniper/docker-intellij

No protocol specified

Start Failed: Failed to initialize graphics environment

java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
	at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
	at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
	at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
...

To resolve this, I ran sudo xhost + (note this method is very insecure, as it allows all incoming X connections).

breandan avatar Jul 22 '18 20:07 breandan

I receive the same error when trying to run intellij programs as sudoer in the container. In case this is causing your error, you can avoid it by running the container as non-sudoer.

To run as specified non-sudoer-user (e.g. developer) in the container (user must exist in the image/container), then you can simply add --user developer to you docker run... command.

DrStoop avatar May 03 '20 04:05 DrStoop