Ask Your Question

Cannot reproduce nvidia-docker2 installation from the tutorial

asked 2018-06-28 00:52:55 -0600

Ilya Kuzovkin gravatar image

updated 2018-06-28 01:17:38 -0600

Hello, I've been trying to get OpenGL work with nvidia-docker2 to run gazebo in Docker.
I've started to repeat the steps outlined in "1.2 nvidia-docker2" section of this tutorial.

First, I've found some mistakes in it:

  • One should do RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata, the current installation command does not work -- the installation process hangs when selecting location area
  • Package lsb_release should be lsb-release
  • One needs to also install gnupg before running apt-key

After fixing these I got my Docker image built. But the last step, which should display RViz, tells me

root@2e605489cabd:/# rosrun rviz rviz
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :0
Could not connect to any X display.

The host system is Ubuntu 16.04.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-06-28 01:04:49 -0600

Ilya Kuzovkin gravatar image

updated 2018-06-28 01:17:05 -0600

Found the answer. On my system I was running docker from under root (sudo docker instead of just docker inside
To allow root user the access to running X server one must run (on the host machine) the following command
$ xhost +si:localuser:root
Now I am able to run RViz and Gazebo.

edit flag offensive delete link more

answered 2018-06-30 16:22:51 -0600

ruffsl gravatar image

updated 2018-06-30 16:23:31 -0600

With the latest ROS LTS melodic based off from Ubuntu Bionic, ros:melodic-ros-base-bionic comes with libglvnd0 pre installed, so all that is needed is to set the missing Nvidia environmental variables:

FROM ros:melodic-ros-base-bionic

# nvidia-container-runtime

As can be shown here for bionic, although not so yet for stretch:

$ docker run -it --rm ros:melodic-ros-base-bionic dpkg -l libglvnd0
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture     Description
ii  libglvnd0:amd64         1.0.0-2ubuntu2   amd64            Vendor neutral GL dispatch library

I've updated the wiki, however this should eventually work its way as well into the desktop images with this PR:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-06-28 00:52:55 -0600

Seen: 587 times

Last updated: Jun 30 '18