ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I'm not yet totally sure yet as to why, but it appears that using the host network driver then necessitates adding the privileged flag if one also wishes to use the X display simultaneously. I.e. just add --privileged
when using --net=host
with the docker run command when expecting to forward GUI using the X11 sockets.
A small example I used to check this:
FROM osrf/ros2:bouncy-desktop
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
#!/bin/bash
XSOCK=/tmp/.X11-unix
docker run -it --rm \
--runtime=nvidia \
-e DISPLAY=$DISPLAY \
-v $XSOCK:$XSOCK \
-v $HOME/.Xauthority:/root/.Xauthority \
--privileged \
--net=host \
osrf/ros2:bouncy-desktop-nvidia "$@"
docker build -t osrf/ros2:bouncy-desktop-nvidia .
bash run.bash ros2 run rviz2 rviz2
Note that if you're not using nvidia, you can use intel's embedded graphics just as well instead:
http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration#Intel
2 | No.2 Revision |
I'm not yet totally sure yet as to why, but it appears that using the host network driver then necessitates adding the privileged flag if one also wishes to use the X display host's X11 unix socket simultaneously. I.e. just add --privileged
when using --net=host
with the docker run command when expecting to forward GUI using the host X11 sockets.display.
A small example I used to check this:
FROM osrf/ros2:bouncy-desktop
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
#!/bin/bash
XSOCK=/tmp/.X11-unix
docker run -it --rm \
--runtime=nvidia \
-e DISPLAY=$DISPLAY \
-v $XSOCK:$XSOCK \
-v $HOME/.Xauthority:/root/.Xauthority \
--privileged \
--net=host \
osrf/ros2:bouncy-desktop-nvidia "$@"
docker build -t osrf/ros2:bouncy-desktop-nvidia .
bash run.bash ros2 run rviz2 rviz2
Note that if you're not using nvidia, you can use intel's embedded graphics just as well instead:
http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration#Intel
3 | No.3 Revision |
I'm not yet totally sure yet as to why, but it appears that using the host network driver then necessitates adding the privileged flag if one also wishes to use the host's X11 unix socket simultaneously. I.e. just add --privileged
when upon using --net=host
with the docker run command when expecting to forward GUI using the host containerised GUIs to the host's X11 display.
A small example I used to check this:
FROM osrf/ros2:bouncy-desktop
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
#!/bin/bash
XSOCK=/tmp/.X11-unix
docker run -it --rm \
--runtime=nvidia \
-e DISPLAY=$DISPLAY \
-v $XSOCK:$XSOCK \
-v $HOME/.Xauthority:/root/.Xauthority \
--privileged \
--net=host \
osrf/ros2:bouncy-desktop-nvidia "$@"
docker build -t osrf/ros2:bouncy-desktop-nvidia .
bash run.bash ros2 run rviz2 rviz2
Note that if you're not using nvidia, you can use intel's embedded graphics just as well instead:
http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration#Intel