using RViZ in Docker
Hello everybody,
i would like to use Rviz in a Docker Container with ROS-Kinetic, which is using also on the host system. The host-system has this software and hardware implemented:
- Ubuntu 16.04
- ROS-Kinetic
- Nvidia GTX 1060 and the driver 384.130
- installed nvidia-docker2
The idea is to create a docker-container from the current software version, to update the whole system later. So i found this Introduction on ROS Wiki, which I need to visualize the container. So i tried the nvidia-docker2 part, but it doesnt worked. I running the container with the following arguments:
docker run –name doc_geste –gpus all –network host –env=DISPLAY -env=NVIDIA-VISIBLE_DEVICES=all -env=NVIDIA_DRIVER_CAPABILITIES=all –env=QT_X11_NO_MITSHM=1 -v /tmp/.X11-unix:/tmp/.X11-unix:rw –runtime=nvidia –privileged -it docker_geste
Before i started the docker container i enter the following line in the terminal: xhost +local:docker
The error which i get is:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
My Dockerfile (i edit some of this line):
FROM stereolabs/zed:2.2-devel-cuda9.0-ubuntu16.04
# Possible to use "Source"
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
# Setup ROS
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata && \
sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install ros-kinetic-desktop-full ros-kinetic-openni2-* python-rosinstall python-rosdep python-rosinstall-generator python-wstool build-essential nano python-catkin-tools git openssh-server nano net-tools iputils-ping python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose ros-kinetic-rosbridge-server ros-kinetic-twist-mux ros-kinetic-cob-scan-unifier ros-kinetic-joy software-properties-common ros-kinetic-ddynamic-reconfigure-python x11-xserver-utils mesa-utils libgl1-mesa-glx\
cmake usbutils git -y --allow-unauthenticated && \
rm -rf /var/lib/apt/lists/*
RUN add-apt-repository ppa:gijzelaar/snap7; \
apt-get update && apt-get install -y --no-install-recommends libsnap7-dev libsnap71; \
mkdir -p /root/.ssh/ #&& chmod 700 /root/.ssh
SOME GITLAB STAFF
RUN rosdep init && \
rosdep update --rosdistro kinetic && \
cd /home/ && mkdir -p robot/fifi_geste_ws/src/
WORKDIR /home/robot/
COPY SOME DATA to Docker
RUN tar -xzvf cudnn-9.0-linux-x64-v7.tgz; \
cp cuda/include/cudnn*.h /usr/local/cuda/include; \
cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64; \
chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*; \
rm cudnn-9.0-linux-x64-v7.tgz; \
rm -r cuda
RUN cd fifi_geste_ws/src; \
#Get the ROS-Package in my Workspace
rm -rf /var/lib/apt/lists/* && cd .. && \
catkin_make -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs -DCUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/stubs -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"; \
rm /root/.ssh/id_ed25519
COPY /Docker_Geste/SN16233.conf /usr/local/zed/settings/
My SH-FIle
# If not working, first do: sudo rm -rf /tmp/.docker.xauth
# It still not working, try running the script as root.
XAUTH=/tmp/.docker.xauth
echo "Preparing Xauthority data..."
xauth_list=$(xauth nlist :0 | tail -n 1 | sed -e 's/^..../ffff/')
if ...
Please take a look at this prior answer: https://answers.ros.org/question/3001...
It’s for ROS Melodic but I believe you can use it for Kinetic as well. There is confirmation as recent as of June 2021
so i tried this, but it didnt worked. I get the same error again.
I add with my my docker_file and the SH-File on the question.