How to use host DISPLAY within docker

Solution 1:

Though this question is very old and many people may have similar issue/question.

I searched google and tried all the methods from different website. But none worked. Then I used host pid in docker and it worked.

Try using host pid in the docker.

$ xhost +local:
$ docker run --pid=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro image