Skip to content

Instantly share code, notes, and snippets.

@jacobschwan
Created January 10, 2022 21:22
Show Gist options
  • Save jacobschwan/2db112bc5b6475e28450135fa1bbd988 to your computer and use it in GitHub Desktop.
Save jacobschwan/2db112bc5b6475e28450135fa1bbd988 to your computer and use it in GitHub Desktop.
Docker NVIDIA Support

1. Install NVIDIA container tools w/ this guide:

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker

2. Add the following environment variables to docker-compose.yml

environment:
  - NVIDIA_VISIBLE_DEVICES=all
  - NVIDIA_DRIVER_CAPABILITIES=compute,video,utility

3. Set/Verify Default Docker Runtime

I can't remember if the nvidia-docker2 package did this or if I had to manually set it as the default runtime, so check \etc\docker\daemon.json to see if it looks like the following:

{
  "default-runtime": "nvidia",
   "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment