Render with OptiX inside docker


I’m currently trying to render frames with Blender using OptiX inside of Docker. The host machine is a g4dn.xlarge EC2 instance, with a Nvidia T4 GPU attached and nvidia driver/nvidia-docker2 installed. When forcing the use of OptiX on the host machine, the rendering script works properly. However, if I try to run the same script inside of an Ubuntu Docker image, I get the following error:

OPTIX_ERROR_UNKNOWN in optixDeviceContextCreate(cuContext, &options, &context) (device_optix.cpp:235)

Please find here the Dockerfile I’m using to build the image.

I found this issue that seems to be somehow related and states that some files need to be mounted into the container:


When not mounting them, the OptiX device query does not work at all. When mounting them, the device query works but the rendering fails with the aforementioned error.
Also please find below the output of the nvidia-smi command on the host machine:

| NVIDIA-SMI 450.51.06    Driver Version: 450.51.06    CUDA Version: 11.0     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  Tesla T4            Off  | 00000000:00:1E.0 Off |                    0 |
| N/A   24C    P8     9W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|  No running processes found                                                 |

Do you folks have any hints ?

Thanks a lot in advance

Hi @paul61, welcome!

I think a T4 is supposed to work with OptiX 7, but using OptiX from within docker has always been a little sketchy due to the need to mount driver components manually. Unfortunately I don’t yet have any experience using docker with OptiX, but my first guess is that there’s another .so file you need to mount.

Here are a few things I can think to try:

  • Inside your docker environment, you can run strace on your process and see if the failure is due to a missing .so file.

  • Which version of the OptiX 7 SDK are you using? The latest version (7.2) requires a 455 driver or higher, and you’re on 450.

  • Does nvidia-smi run from inside docker? What is the output?

  • Does your code run on this host outside of the docker environment?

  • Can you run a CUDA sample inside your docker environment? One easy thing you can test without installing CUDA samples is, if you haven’t already, put a call to cudaFree(0) before calling either optixDeviceContextCreate() or optixInit(), and make sure the cuda call succeeds.