(Strictly speaking, this is not an answer, but I needed more characters than the comment allowed)
For students, I would take a look at Singularity.
It uses the same techniques, but doesn't require super user rights, mounts $HOME
by default, runs everything as the $USER
that started the container, and allows access to devices and GPUs by default.
There isn't even any special configuration needed with Singularity containers to be able to use GUIs.
And it allows you to import/run/exec Docker images, so you can start from osrf/ros:kinetic-desktop-full
for instance.
Edit: as an answer to your original question: yes, it's certainly possible to run GUI applications from inside Docker containers. Some of the approaches are documented over at wiki/docker. An alternative can be seen at osrf/car_demo.
Edit2: here's a three line example to get RViz running from inside a Singularity "shell" (essentially equivalent to a docker run -it ..
):
# needed once: converts Docker image into Singularity image on your local system
singularity pull --name ros-kinetic-desktop-full.simg docker://osrf/ros:kinetic-desktop-full
# in terminal 1: roscore
singularity exec -p ./ros-kinetic-desktop-full.simg bash -c 'source /opt/ros/kinetic/setup.bash; roscore'
# in terminal 2: rviz
# if you have nvidia hw and the proprietary driver installed:
singularity exec --nv -p ./ros-kinetic-desktop-full.simg bash -c 'source /opt/ros/kinetic/setup.bash; rviz'
# if you have a built-in Intel GPU or are using nouveau
singularity exec -p ./ros-kinetic-desktop-full.simg bash -c 'source /opt/ros/kinetic/setup.bash; rviz'
Note: I'm using Singularity 2.5.2 commands here. Singularity 2.6 (and 3.0) will have changed the way it interacts with NVidia hw.
The -p
is to make sure all child processes in the container are terminated when the container terminates.