Oh, this thread slipped past me. Thanks for the shout out @esteve.
I’ve been using both nvidia and intel graphics for OpenGL dependent ROS apps inside containers just fine for the past year or more. I just tested both nvidia and intel methods now as described in the ros wiki you linked, and rviz and gazebo render just fine with both discrete and integrated graphic cards that I have. Rviz is buttery smooth for both intel and nvidia, however qzclient only has a decent frame rate on my 4K host’s screen if I either switch to my discrete nvidia card, or shrink the ogre3d preview to something smaller than fullscreen. Also note, that when you start gazebo for the first time in a fresh container, it’ll take a bit before you see the rendered preview, as I think gazebo is initializing (downloading?) some files on first startup, so perhaps best to make a volume for that to make them persistent between runs and save time.
Here is my setup for reference:
$ uname -a
Linux dox 4.9.0-040900-generic #201612111631 SMP Sun Dec 11 21:33:00 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
$ lspci -v | less
00:02.0 VGA compatible controller: Intel Corporation Skylake Integrated Graphics (rev 06) (prog-if 00 [VGA controller])
DeviceName: Onboard IGD
Subsystem: Dell Skylake Integrated Graphics
Flags: bus master, fast devsel, latency 0, IRQ 127
Memory at db000000 (64-bit, non-prefetchable) [size=16M]
Memory at 70000000 (64-bit, prefetchable) [size=256M]
I/O ports at f000 [size=64]
[virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: i915
Kernel modules: i915
...
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)
Subsystem: Dell GM107M [GeForce GTX 960M]
Flags: bus master, fast devsel, latency 0, IRQ 138
Memory at dc000000 (32-bit, non-prefetchable) [size=16M]
Memory at b0000000 (64-bit, prefetchable) [size=256M]
Memory at c0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
[virtual] Expansion ROM at dd000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_375_drm, nvidia_375
$ nvidia-docker run --rm nvidia/cuda nvidia-smi
Wed Mar 15 05:38:39 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.26 Driver Version: 375.26 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 960M Off | 0000:01:00.0 Off | N/A |
| N/A 52C P0 N/A / N/A | 1433MiB / 2002MiB | 6% Default |
+-------------------------------+----------------------+----------------------+
$ nvidia-docker -v
Docker version 1.13.1, build 092cba3
The latest kernel/nvidia driver/plugin are not really necessary, I recall everything working fine stock trusty.
One thing I’d like to try and do is create a command line tool and bootstraps a development container, mounting your source workspaces, attaches devices and display/audio unix sockets, maintains your user permissions, attach containers to host’s subnets, etc. Sort of like parts done with docker-browser-box, but only more ROS focused. I wonder if I go searching again if I’d find another project already doing this for general desktop applications.
If you’d like to dockerize other common CLI/GUI apps, I’d highly recommend checking out Jess Frazelle’s collection of dockerfiles for desktop applications from android IDEs, virtualbox, wine, vlc, spotify, htop, ect: