Installs and configures the NVIDIA Container Toolkit for Docker on RPM-based systems.
- Adds the official NVIDIA Container Toolkit RPM repository.
- Installs the
nvidia-container-toolkitpackage. - Configures
/etc/docker/daemon.jsonwith the NVIDIA runtime. - Reloads Docker when the daemon configuration changes (running containers keep running).
- RPM-based OS (RHEL, Rocky, AlmaLinux, CentOS, Fedora)
- Docker already installed
- NVIDIA GPU drivers already installed on the host
| Variable | Default | Description |
|---|---|---|
nvidia_container_toolkit_repo_url |
https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo |
URL to the NVIDIA Container Toolkit RPM repository file. |
nvidia_docker_default_runtime |
nvidia |
The default container runtime for Docker. |
nvidia_docker_live_restore |
false |
Set "live-restore": true, so containers keep running while dockerd restarts (e.g. a docker-ce patch upgrade). |
- nvidia_driver_cuda
- elan.docker_install
- hosts: gpu_nodes
roles:
- nvidia_driver_cuda
- elan.docker_install
- nvidia_container_toolkit- hosts: gpu_nodes
roles:
- role: nvidia_container_toolkit
vars:
nvidia_docker_default_runtime: "runc"- Reload Docker: Triggered when /etc/docker/daemon.json is modified. Every key the template sets (
default-runtime,runtimes,live-restore) is one dockerd applies on reload, so no container is restarted, including when live-restore is switched on.
- This role overwrites /etc/docker/daemon.json. If you have existing Docker daemon configuration, merge it into the templates/daemon.json.j2 template.
- This role does not install GPU drivers. Make sure drivers are present before running it.
- This role only supports RPM-based distributions. For Debian/Ubuntu, the repository setup task needs to be adapted.