Reputation: 1085
Although the container should have the needed privileges to connect to the display, I got this error each time:
docker exec -it my_container
/# rqt
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
QXcbConnection: Could not connect to display :1
Could not connect to any X display.
The following command has been used to run the container:
sudo docker run -itd --restart unless-stopped --name my_container --privileged --net=host --gpus all \
--env="NVIDIA_DRIVER_CAPABILITIES=all" \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
my_image:v1.1
Upvotes: 6
Views: 16623
Reputation: 1085
The solution is to run the following command in your terminal:
xhost +local:docker
Then try again, it should work:
docker exec -it my_container
/# rqt
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Upvotes: 9