Skip to content

use_docker_with_nvidia_gpu

Axel Schwab edited this page Mar 12, 2024 · 3 revisions

under_construction.png

Use Docker with nvidia GPU

Installation

Important

Make sure you have a Nvidia GPU and installed the driver.

  1. To run docker with nvidia gpu support, you need to install the nvidia container toolkit
  2. Configure docker to use the nvidia runtime, see nvidia documentation (rootless mode not required)
  3. Test the installation with
    • sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

Usage

Important

To use the nvidia runtime, with Ẁinslow see environment variables

Troubleshooting

If you encounter some problems, you can check the following:

  • To check if the nvidia runtime is correctly configured, run
    • docker info | grep -i runtimes
    • you should see something like
      Runtimes: nvidia runc
      Default Runtime: runc
      
  • Or see the configuration file
    • cat /etc/docker/daeon.json
      ...
      {
          "runtimes": {
              "nvidia": {
              "args": [],
              "path": "nvidia-container-runtime"
              }
          }
      } 
      ...
      

Clone this wiki locally