Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

OpenGL Support #11

Closed
ruffsl opened this issue Nov 18, 2015 · 15 comments
Closed

OpenGL Support #11

ruffsl opened this issue Nov 18, 2015 · 15 comments

Comments

@ruffsl
Copy link
Contributor

ruffsl commented Nov 18, 2015

As mentioned by @3XX0 in #7 , OpenGL is not supported with the current framework, yet there is an ongoing discussion internally in Nvidia to enable it. This issues serves as a means for users to track progress or propose recommendations. May want to ask @jfrazelle for some ideas, I know she's experimented a good deal in OpenGL support for docker containers.

@jessfraz
Copy link

I would love to help I used to have a Mac w Linux but don't anymore so I'm unsure how much help I can be with testing but I can give ideas has to how to have libs installed in a container and devices to mount

@flx42
Copy link
Member

flx42 commented Nov 20, 2015

Thank you, @jfrazelle!
We definitely have the right people here to help us understand the different components of the graphics stack, but we will probably need some help in understanding how it can fit with Docker.

We haven't started working on this, I will update this issue when we do.

@ruffsl
Copy link
Contributor Author

ruffsl commented Dec 2, 2015

@flx42 or @3XX0 , could you elaborate on the reasons behind this OpenGL issue. What details are currently missing or not supported that prevents even an traditional apt-get installed application within the container from using OpenGL. I admit I'm a bit unaware of inner workings of the graphics stack here, and am still curious.

@3XX0
Copy link
Member

3XX0 commented Dec 2, 2015

We have a basic plan on how things should work but quite frankly it's not a priority for us internally at the moment and it might take some time to implement.

Dealing with OpenGL is tedious and doing it cleanly with proper buildtime/runtime separation is tricky. You have to take into account things like direct/indirect rendering, GLX/EGL, GL extensions and dispatching. Also our drivers change quickly and it's hard to keep up with their underlying OpenGL implementation.
If you are curious, https://github.com/NVIDIA/libglvnd provides some more information on how those things could be solved.

@3XX0
Copy link
Member

3XX0 commented Jun 24, 2016

Actually, @jfrazelle I would love your insights on this one moby/moby#23917
We could probably add some GLX/X11 magic in there as well.

@silgon
Copy link

silgon commented Jul 30, 2016

Hello guys. I got a problem related to this issue today. I have the nvidia installed in my computer, more specifically the version 352.63. Below you'll find my workaround, maybe it could be useful for you.

# variable with all the needed values for libgl and to be accessed through LD_LIBRARY_PATH
DOCKER_VISUAL_NVIDIA="-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/nvidia0 --device /dev/nvidiactl -v /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0:/external_libs/libXau.so.6.0.0 -v /usr/lib/x86_64-linux-gnu/libXdmcp.so.6:/external_libs/libXdmcp.so.6 -v /usr/lib/x86_64-linux-gnu/libXext.so.6:/external_libs/libXext.so.6 -v /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0:/external_libs/libXdmcp.so.6.0.0 -v /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0:/external_libs/libX11.so.6.3.0 -v /usr/lib/x86_64-linux-gnu/libxcb.so.1:/external_libs/libxcb.so.1 -v /usr/lib/nvidia-352/libGL.so.352.63:/external_libs/libGL.so.352.63 -v /usr/lib/nvidia-352/libnvidia-glcore.so.352.63:/external_libs/libnvidia-glcore.so.352.63 -v /usr/lib/nvidia-352/libGL.so.1:/external_libs/libGL.so.1 -v /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0:/external_libs/libXext.so.6.4.0 -v /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0:/external_libs/libxcb.so.1.1.0 -v /usr/lib/x86_64-linux-gnu/libX11.so.6:/external_libs/libX11.so.6 -v /usr/lib/x86_64-linux-gnu/libXau.so.6:/external_libs/libXau.so.6 -v /usr/lib/nvidia-352/tls/libnvidia-tls.so.352.63:/external_libs/libnvidia-tls.so.352.63 --env=LD_LIBRARY_PATH=/external_libs"
# run the program
docker run --rm $DOCKER_VISUAL_NVIDIA -e QT_X11_NO_MITSHM=1 -v $HOME/.ros:$HOME/.ros:rw -v $HOME/.gazebo:$HOME/.gazebo:rw osrf/ros:kinetic-desktop-full roslaunch gazebo_ros empty_world.launch

The folders $HOME/.ros and $HOME/.gazebo are needed by the simulator (you can create empty folders mkdir $HOME/.ros $HOME/.gazebo). If you want to try the code, please change the 352 and 352.63 to your version of nvidia drivers before running the code (verify the declaration of the DOCKER_VISUAL_NVIDIA variable), it should work. I spent half a day trying to get this to work because I didn't know it was a problem with nvidia operating libgl. This example is based on this website and it uses a container of the open source robotics foundation. @ruffsl may be intereseted, or maybe he already have another workaround.

@Kaixhin
Copy link

Kaixhin commented Sep 12, 2016

If anyone is looking here for solutions then I have a supposedly working setup documented here (tested quickly with glxgears and gazebo). Still haven't found an OpenGL over VNC solution for remote access though...

@3XX0
Copy link
Member

3XX0 commented Sep 12, 2016

Checkout the opengl branch, we have OpenGL over VNC there through VirtualGL.

@Kaixhin
Copy link

Kaixhin commented Sep 13, 2016

@3XX0 Thanks for the tip - any pointers on how to set up a VNC server in a Docker container once VirtualGL has been installed? I haven't had any luck adapting the containers I've used before - seems more complex than just adding vglrun beforehand.

@3XX0
Copy link
Member

3XX0 commented Sep 13, 2016

It all depends on what you are trying to do. Generally I would recommend putting the VNC server on your host alongside the X server (at least that's how I did it). You can point the VirtualGL containers at whatever you like using DISPLAY, VGL_CLIENT and VGL_DISPLAY.

See here and there to see how it works (just imagine containers on top of that).

@bbarker
Copy link

bbarker commented Oct 4, 2017

I seem to have OpenGL acc working using docker run --privileged - not ideal, but ok for some cases where isolation and security aren't a huge concern.

My full docker run command:

CMD="${DOCKER} run --detach=true \                                                                                                                                                                                                                                                                                                                                           
                --privileged \                                                                                                                                                                                                                                                                                                                                               
                --group-add ${DOCKER_GROUP_ID} \                                                                                                                                                                                                                                                                                                                             
                --env HOME=${HOME_DIR} \                                                                                                                                                                                                                                                                                                                                     
                --env DISPLAY \                                                                                                                                                                                                                                                                                                                                              
                --interactive \                                                                                                                                                                                                                                                                                                                                              
                --name DevContainer \                                                                                                                                                                                                                                                                                                                                        
                --net=host \                                                                                                                                                                                                                                                                                                                                                 
                --rm \                                                                                                                                                                                                                                                                                                                                                       
                --tty \                                                                                                                                                                                                                                                                                                                                                      
                --user=${USER_ID}:${GROUP_ID} \                                                                                                                                                                                                                                                                                                                              
                --volume $HOME_DIR_HOST:${HOME_DIR} \                                                                                                                                                                                                                                                                                                                        
                --volume $WORK_DIR:${WORK_DIR} \                                                                                                                                                                                                                                                                                                                             
                --volume /tmp/.X11-unix:/tmp/.X11-unix \                                                                                                                                                                                                                                                                                                                     
                --volume /var/run/docker.sock:/var/run/docker.sock \                                                                                                                                                                                                                                                                                                         
                ${IDEA_IMAGE}"

Link to my dockerfile repo - mainly of interest are idea.sh and Dockerfile (and large parts of them are NOT of interest also! :) ).

@Brm-Bremen
Copy link

Brm-Bremen commented Oct 27, 2017

Hey,

we need to run a Webbrowser inside of a Nvidia-docker container.
Therefore GL is needed (or it is going to be very slow).

The Solution with VirtualGL looks like it could work but I was not yet able to get GL-support inside of the docker-container.

The newest Nvidia-driver is installed on the host-system . A "invalid-smi" tells me the docker-container has also recognized the GPU and has the newest driver installed.
Inside of the container I installed the mate-desktop-environment, virtualGL and Turbovnc. I can connect to the container via VNC and use it, but GL is missing. Typing "vglrun glxgears" returns:
Xlib: Extension "GLX" is mission on display ":0". Error: couldn't´t get a RGB, Double-buffered visual
"vglrun glxinfo" does kind of tell the same story besides printing the same message ~10 times.

After finding your opengl-branch I build my setup on top of it, but I still can´t get it to work.

Do I need to setup VirtualGl somehow?
Do I maybe need to install Xvfb? (I read about that somewhere but I didn't´t understand why it was necessary and how it would be used.)

I hope you can help me with this.

Best Regards
Joscha Knobloch

@flx42
Copy link
Member

flx42 commented Jan 11, 2018

We now have beta images for OpenGL on DockerHub:
https://hub.docker.com/r/nvidia/opengl/
As noted in the description, we don't officially support rendering to X11. It's of course possible to make it work as many of you know, but we won't be able to help you until we officially support this use case.

Those images are based on libglvnd for the OpenGL API calls dispatch.
https://github.com/NVIDIA/libglvnd

Dockerfiles are here:
https://gitlab.com/nvidia/opengl

@phil294
Copy link

phil294 commented Mar 18, 2018

The images are not available as described. docker pull nvidia/opengl:glvnd-runtime is not found, only the :base image.

@flx42
Copy link
Member

flx42 commented Mar 18, 2018

It's 1.0-glvnd-runtime.

@NVIDIA NVIDIA locked as resolved and limited conversation to collaborators Mar 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants