Skip to main content
  1. Nvidia-container-toolkit. Ensure the Nvidia-container-toolkit is installed and properly configured.
  2. Docker Daemon. Check if Docker Daemon is running.
  3. GPU Configuration. Docker needs to be configured with the Nvidia runtime to use the GPU inside a container. This can be fixed by installing and configuring the Nvidia-container-toolkit.

Debugging:

  1. Test GPU with Docker: Run the following command to check if Docker can access the GPU:
    If nvidia-smi output is visible, Docker can use the GPU inside the container. If not, try restarting Docker Daemon:
    Else there might be some error similar to the following:
  2. Error Debugging: If errors related to nvidia-container-toolkit are shown, it may not be installed or configured correctly.

Commands to Check Nvidia-container-toolkit Installation:

  1. Check if Nvidia-container-toolkit is installed:
  2. If it’s installed but not configured properly, follow one of the two methods below:

Method 1: Configure daemon.json:

  1. Open the daemon.json file:
  2. Paste the following:
  3. Save and exit, then reboot the server:
  4. After reboot, restart Docker:

Method 2: Configure Nvidia-ctk Directly:

Run the following commands:

If Nvidia-container-toolkit is Not Installed:

  1. Install Nvidia-container-toolkit:
  2. Enable experimental features:
  3. Update and install the toolkit:

Verify Nvidia-container-toolkit:

  1. Check if the toolkit is in the $PATH:
  2. Verify the runtime is configured:
    Sample output:

Final GPU Test:

Run the following command to test if Docker can use the GPU: