My goal is to run arbitrary GUI applications from Docker container using host Xserver.
I tried http://wiki.ros.org/docker/Tutorials/GUI#The_simple_way - Step 1
I would run the docker image using docker run --gpus all --net=host -it -p "8888:8888" -v "/home/gillian/Documents/deeplearning/:/deeplearning/:" --env=DISPLAY=$DISPLAY --env=QT_X11_NO_MITSHM=1 --volume=/tmp/.X11-unix:/tmp/.X11-unix:rw pytorch
But when I tried to run xlogo or xclock from within the container, it would always return error Error: Can't open display: :0
after spending the night trying to fix it I tried to use --net=host
as an argument for docker run. And then I could run xclock and xlogo and it would display them on my screen without any issues.
Why?
What can I do to run the docker image without sacrificing the network isolation (--net=host)?
I am running Kubuntu 20.04