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. - Restarts Docker when the daemon configuration changes.
- 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_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"- Restart Docker: Triggered when /etc/docker/daemon.json is modified.
- 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.