Docker, X11 fails to open display
I have a docker container and I want to run an app that requires X11. I want to expose that in the host. This is actually working well in a notebook but fails in a desktop.
More info:
I am launching docker with the correct arguments:
docker run -it --rm \
--privileged \
-e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
.... not related options ....
$(DOCKER_IMAGE) \
xclock
In a notebook (Ubuntu 19.10) works great BUT when I try the same in a desktop (Ubuntu 19.10), I get Error: Can't open display: :1
There is somehow something different and I cannot find out what the difference is.
I have already:
- Disabled access control
xhost +
- There is no
~/.Xauthority
file - No firewall enabled
- Containers are identical (both computers download the image from Dockerhub).
- This is not about SSH at all, so X11 forwarding is not relevant.
- Both computers are using X11 (no wayland involved)
I have noticed that notebook uses :0
and desktop :1
but I don't think that is relevant.
Question: Are there any log files that I could look at? Any tips on debugging the issue?
Solution 1:
Had the exact same problem with a laptop. It worked for me if I added --net=host. Never bothered to figure out why.