Setting up Linux GUI container on Mac

Liang-Chi Hsieh
2 min readMay 30, 2019

--

In recent days, I have a new mission. Which is related to robotics. The first thing I’m going to learn, is ROS. I’m a Mac user, so I would like to set up ROS development environment on Mac. I can run Ubuntu Linux in a VM thro, I prefer to use Docker so the environment can be used and tested by others.

Firstly, I tried X11 on Mac, aka XQuartz. It isn’t too hard to run Linux in a container and display on X11 on Mac. The following document is useful:

One thing needs more attention is, XQuartz doesn’t enable GLX by default. So it is needed to set it for XQuartz:

defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

But it doesn’t solve all problems.

Above solution supports only OpenGL 1.4, as it uses indirect rendering. ROS programs like Rviz requires OpenGL 2.1. That means X11 isn’t a workable option for ROS on Mac.

ROS docker GUI wiki describes VNC as alternative option. I tested few dockerfiles at https://github.com/Kaixhin/dockerfiles. For example, https://github.com/Kaixhin/dockerfiles/tree/master/vnc-ros. When I upgrade Ubuntu and ROS versions, some weird errors are there. LXDE desktop (lxde-core) on Ubuntu 18.04 seems not to work under VNC, as gnome-session complains when doing acceleration hardware check:

gnome-session-binary[24]: WARNING: software acceleration check failed: Child process exited with code 1
gnome-session-binary[24]: CRITICAL: We failed, but the fail whale is dead.

Interestingly, if changing from lxde-core to lxde package, it works.

Although using lxde can make GUI work, GLX doesn’t work for such containers. An error is shown in xsession’s log:

name of display: :1.0

Error: couldn’t find RGB GLX visual or fbconfig

On ROS wiki, it also introduces a docker image at https://hub.docker.com/r/ct2034/vnc-ros-kinetic-full/. This docker image uses xvfb as X display server. VNC can work with it. I’m not pretty sure if xvfbis the cause, but GLX works. This image also installs noVNC package to provide HTML5 VNC interface.

--

--