Unable to run FleX despite having OpenGL -- Could not initialize GL extensions

I just compiled FleX 1.2 using a Singularity container that I built (bootstrapped with NVIDIA Docker nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04) and wanted to run the demo visually through X11 (XFCE) forwarding but I get the following error:

./bin/linux64/NvFlexDemoReleaseCUDA_x64
Could not initialize GL extensions
Reshaping
Segmentation fault (core dumped)

The way I shell into the container is by doing singularity shell --nv flexContainer.simg. Need to mention that I do export __GLX_VENDOR_LIBRARY_NAME=nvidia before running the demo. I also install the required libraries such as xserver-xorg, freeglut3-dev and mesa-utils through apt-get install. Here’s the outputs of glxinfo:

glxinfo 
name of display: localhost:10.0
display: localhost:10  screen: 0
direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
    GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_visual_info, 
    GLX_EXT_visual_rating, GLX_OML_swap_method, GLX_SGIS_multisample, 
    GLX_SGIX_fbconfig, GLX_SGIX_hyperpipe, GLX_SGIX_swap_barrier, 
    GLX_SGI_make_current_read
client glx vendor string: NVIDIA Corporation
client glx version string: 1.4
client glx extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context, 
    GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, 
    GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, 
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_buffer_age, 
    GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, 
    GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, 
    GLX_EXT_import_context, GLX_EXT_stereo_tree, GLX_EXT_swap_control, 
    GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_NV_copy_buffer, 
    GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, 
    GLX_NV_multisample_coverage, GLX_NV_present_video, 
    GLX_NV_robustness_video_memory_purge, GLX_NV_swap_group, 
    GLX_NV_video_capture, GLX_NV_video_out, GLX_SGIX_fbconfig, 
    GLX_SGIX_pbuffer, GLX_SGI_swap_control, GLX_SGI_video_sync
GLX version: 1.2
GLX extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig
OpenGL vendor string: Mesa project: www.mesa3d.org
OpenGL renderer string: Mesa GLX Indirect
OpenGL version string: 1.2 (1.5 Mesa 6.4.1)
OpenGL extensions:
    GL_ARB_depth_texture, GL_ARB_imaging, GL_ARB_multitexture, 
    GL_ARB_point_parameters, GL_ARB_point_sprite, GL_ARB_shadow, 
    GL_ARB_texture_border_clamp, GL_ARB_texture_cube_map, 
    GL_ARB_texture_env_add, GL_ARB_texture_env_combine, 
    GL_ARB_texture_env_crossbar, GL_ARB_texture_env_dot3, 
    GL_ARB_texture_mirrored_repeat, GL_ARB_transpose_matrix, 
    GL_ARB_window_pos, GL_ATI_texture_mirror_once, GL_EXT_abgr, GL_EXT_bgra, 
    GL_EXT_blend_color, GL_EXT_blend_func_separate, GL_EXT_blend_minmax, 
    GL_EXT_blend_subtract, GL_EXT_draw_range_elements, GL_EXT_fog_coord, 
    GL_EXT_multi_draw_arrays, GL_EXT_packed_pixels, GL_EXT_rescale_normal, 
    GL_EXT_secondary_color, GL_EXT_separate_specular_color, 
    GL_EXT_shadow_funcs, GL_EXT_stencil_two_side, GL_EXT_stencil_wrap, 
    GL_EXT_texture3D, GL_EXT_texture_edge_clamp, GL_EXT_texture_env_add, 
    GL_EXT_texture_env_combine, GL_EXT_texture_env_dot3, 
    GL_EXT_texture_lod_bias, GL_EXT_texture_object, GL_EXT_vertex_array, 
    GL_IBM_texture_mirrored_repeat, GL_NV_blend_square, GL_NV_point_sprite, 
    GL_NV_texgen_reflection, GL_NV_texture_rectangle, GL_SGIS_generate_mipmap, 
    GL_SGIS_texture_lod, GL_SGIX_depth_texture, GL_SGIX_shadow

8 GLX Visuals
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x0cd 24 tc  0  24  0 r  y .   8  8  8  0 .  .  0 16  0  0  0  0  0  0 0 None
0x0ce 24 tc  0  24  0 r  y .   8  8  8  0 .  .  0 16  8 16 16 16  0  0 0 None
0x0cf 24 tc  0  32  0 r  y .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None
0x0d0 24 tc  0  32  0 r  . .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None
0x0d1 24 dc  0  24  0 r  y .   8  8  8  0 .  .  0 16  0  0  0  0  0  0 0 None
0x0d2 24 dc  0  24  0 r  y .   8  8  8  0 .  .  0 16  8 16 16 16  0  0 0 None
0x0d3 24 dc  0  32  0 r  y .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None
0x0d4 24 dc  0  32  0 r  . .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None

8 GLXFBConfigs:
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x0cd 24 tc  0  24  0    y .   8  8  8  0 .  .  0 16  0  0  0  0  0  0 0 None
0x0ce 24 tc  0  24  0    y .   8  8  8  0 .  .  0 16  8 16 16 16  0  0 0 None
0x0cf 24 tc  0  32  0    y .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None
0x0d0 24 tc  0  32  0    . .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None
0x0d1 24 dc  0  24  0    y .   8  8  8  0 .  .  0 16  0  0  0  0  0  0 0 None
0x0d2 24 dc  0  24  0    y .   8  8  8  0 .  .  0 16  8 16 16 16  0  0 0 None
0x0d3 24 dc  0  32  0    y .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None
0x0d4 24 dc  0  32  0    . .   8  8  8  8 .  .  0 16  8 16 16 16 16  0 0 None

Doing glxinfo | OpenGL yields this:

OpenGL vendor string: Mesa project: www.mesa3d.org
OpenGL renderer string: Mesa GLX Indirect
OpenGL version string: 1.2 (1.5 Mesa 6.4.1)
OpenGL extensions:

And doing lspci | grep VGA yields this:

02:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
03:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
06:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 30)
82:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
83:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)

And here’s the output of ldd /usr/bin/glxinfo:

linux-vdso.so.1 =>  (0x00007ffe4f7ac000)
libGL.so.1 => /.singularity.d/libs/libGL.so.1 (0x00002b6bf9484000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00002b6bf9728000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00002b6bf9a62000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00002b6bf9e2c000)
libGLX.so.0 => /.singularity.d/libs/libGLX.so.0 (0x00002b6bfa030000)
libGLdispatch.so.0 => /.singularity.d/libs/libGLdispatch.so.0 (0x00002b6bfa260000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00002b6bfa52e000)
/lib64/ld-linux-x86-64.so.2 (0x00002b6bf925c000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00002b6bfa750000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00002b6bfa962000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00002b6bfab66000)

An strange thing is that when I do glxgears the gears do not move. What could be causing that?

Relevant system info:

Ubuntu 16.04
CUDA 9.0
GTX 1080Ti
Driver Version 390.48

Does anyone know what could I be doing wrong?