title: gazebo and rviz in docker stopped working after installing nvidia
body: <p>So long story short: I had a working docker image where i could show graphical things through the Xserver. I tested it multiple times and everything seemed to work flawlessly. However after installing Nvidia and CUDA i started getting this error:</p>
  <pre class="lang-sh prettyprint-override"><code>Error setting socket option (IP_ADD_MEMBERSHIP).
  Error setting socket option (IP_ADD_MEMBERSHIP).
  libGL error: No matching fbConfigs or visuals found
  libGL error: failed to load driver: swrast
  X Error of failed request:  GLXBadContext
    Major opcode of failed request:  151 (GLX)
    Minor opcode of failed request:  6 (X_GLXIsDirect)
    Serial number of failed request:  38
    Current serial number in output stream:  37
  libGL error: No matching fbConfigs or visuals found
  libGL error: failed to load driver: swrast
  X Error of failed request:  GLXBadContext
    Major opcode of failed request:  151 (GLX)
    Minor opcode of failed request:  6 (X_GLXIsDirect)
    Serial number of failed request:  38
    Current serial number in output stream:  37
  </code></pre>
  <p>Since i need CUDA for another project i can't just uninstall it. Currently i'm running these commands:</p>
  <pre class="lang-sh prettyprint-override"><code>docker build -t $container_name $repo_DIR/.
  docker run -it -d --net=host --env=&quot;DISPLAY&quot; --env=&quot;QT_X11_NO_MITSHM=1&quot; --name=$container_name -v $HOME/repos/$container_name/src/:&quot;/home/docker/catkin_ws/src_extern/&quot; --gpus all $container_name bash
  xhost +local:&quot;docker inspect --format='{{ .Config.Hostname }}' $container_name&quot; 
  docker start $container_name 
  docker exec --user docker -it $container_name bash
  </code></pre>
  <p>I've tried different approaches from forums, but i couldn't find anything that worked or any post with my exact problem. Any suggestions? If possible it should also be able to run without cuda/nvidia since i need the image for my laptop too. Also it would be fine if it worked around cuda/nvidia since i don't need it for the docker image anyways.</p>
  <p>Some other information
  I'm Using Arch and <code>CUDA-10.2</code> with <code>nvidia-460</code> driver. The docker image runs on <code>ubuntu:bionic</code> and these are all the files including libGL:</p>
  <pre><code>/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1
  /usr/lib/x86_64-linux-gnu/libGLESv2.so
  /usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0
  /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
  /usr/lib/x86_64-linux-gnu/libGLESv2.so.2
  /usr/lib/x86_64-linux-gnu/libGLU.so.1
  /usr/lib/x86_64-linux-gnu/libGLU.so
  /usr/lib/x86_64-linux-gnu/libGL.so
  /usr/lib/x86_64-linux-gnu/libGLU.a
  /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
  /usr/lib/x86_64-linux-gnu/libGLX.so
  /usr/lib/x86_64-linux-gnu/libGL.so.1
  /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
  /usr/lib/x86_64-linux-gnu/libGLdispatch.so
  /usr/lib/x86_64-linux-gnu/libGLX.so.0.0.0
  /usr/lib/x86_64-linux-gnu/libGLX.so.0
  /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0.0.0
  /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0.0.0
  /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1.0.0
  /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so
  /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0
  /usr/lib/x86_64-linux-gnu/libGLESv2.so.2.0.0
  </code></pre>
  <p>EDIT 1: <strong>Solution</strong>, apparently it was only rviz and gazebo that was broken, and it was fixed by following <a href="http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration#nvidia-docker2" rel="nofollow noreferrer">this</a></p>
  <p>Edit 2: Changed to more relevant title.</p>