Enabling NVIDIA GPU Support in Docker with nvidia-container-toolkit
Step-by-Step Guide to Leveraging GPU Power within Docker Containers
TL;DR To answer the request to use a GPU (nvidia) inside a Docker container, Docker has to be configured for GPU support.
Normally a Docker container cannot access the host’s GPU resources. That is because Docker does not pass the host’s GPU devices through to the container, and the reason behind it is that the GPU driver and the CUDA libraries are not properly shared between the host and the container.
To get around this, the GPU resources have to be passed through to the container with a tool such as nvidia-container-toolkit.
[Read More]