NVIDIA/libnvidia-container
FreeNVIDIA container runtime library
FreeFree tier
About NVIDIA/libnvidia-container
libnvidia-container is a library and CLI utility developed by NVIDIA for automatically configuring GNU/Linux containers to leverage NVIDIA GPU hardware. It relies on kernel primitives and is designed to be agnostic of the container runtime, making it suitable for use with various container runtimes like Docker, containerd, and podman. The library supports multiple Linux distributions (Ubuntu, Debian, CentOS, Amazon Linux, openSUSE) and can be installed via packages or built from source. It includes the nvidia-container-cli tool for isolating GPU devices, loading kernel modules, and configuring namespaces without cgroups. This project is released under the BSD 3-clause license.
Key Features
Library and CLI utility for GPU container configuration
Agnostic of container runtime (Docker, containerd, etc.)
Relies on kernel primitives for device isolation
Supports multiple Linux distributions (Ubuntu, Debian, CentOS, Amazon Linux, openSUSE)
nvidia-container-cli with options like --load-kmods, --no-cgroups, --utility, --device
Can be installed via packages or built from source with Docker
Open source under BSD 3-clause license
Pros & Cons
Pros
- Agnostic of container runtime, works with multiple runtimes
- Relies on kernel primitives, avoiding heavy daemon dependencies
- Supports a wide range of Linux distributions
- Provides both a library and a simple CLI (nvidia-container-cli)
- Open source with permissive BSD license
- Well-maintained by NVIDIA with regular releases (107 releases as of April 2026)
Cons
- Linux only, no support for Windows or macOS containers
- Requires manual namespace setup for direct use; full integration needs nvidia-container-runtime
- Complex setup for isolated environments (pivot_root, mount namespaces) from command line
- Limited to NVIDIA hardware; not applicable for AMD or other GPUs
Best For
Enabling GPU access inside containers for AI/ML workloadsRunning nvidia-smi or other NVIDIA tools from within containersIntegrating with container runtimes like nvidia-container-runtime for seamless GPU supportTesting and developing containerized GPU applications
FAQ
What is libnvidia-container?
libnvidia-container is a library and CLI utility provided by NVIDIA for automatically configuring GNU/Linux containers to access NVIDIA GPU hardware. It works with any container runtime and relies on kernel primitives.
How do I install libnvidia-container?
You can install it from packages for supported Linux distributions (Ubuntu, Debian, CentOS, Amazon Linux, openSUSE) by configuring the package repository, or build from source using Makefile or Docker. See the project README for details.
Is libnvidia-container free and open source?
Yes, it is open source under the BSD 3-clause license and freely available on GitHub.