nvidia-container-toolkit
AGENTS.md4.6k starsChanged 3 months agoApache-2.0View on GitHub
Guidance for AI coding agents working in this repository. Human contributors should also read CONTRIBUTING.md and the documentation site which are the source of truth. The NVIDIA Container Toolkit is a collection of utilities that allow you to run GPU-accelerated containers. It is designed to work with any container runtime, e.g. docker, containerd, cri-o, podman. It is written primarily in Go. Historically, NVIDIA GPUs were injected into containers via an OCI preStart hook. The preStart hook would invoke the nvidia-container-cli…
Trending
Quiet since December.thin dataabout the whole repository
Who's talking about NVIDIA/nvidia-container-toolkit
- TabbyML/tabby“Support run tabby without docker”GitHub · Apr 11, 2023 · 12 reactions
- awslabs/amazon-eks-ami“bug(nvidia-container-toolkit): incorrect `containerd` config”GitHub · Nov 9, 2024 · 10 reactions
- NVIDIA/nvidia-docker“Failures on Debian with `ldconfig`”GitHub · Oct 14, 2020 · 8 reactions
- podman-container-tools/podman“`docker-compose`: Passing gpu with `driver: cdi` is not supported”GitHub · Jul 24, 2023 · 7 reactions
- NVIDIA/libnvidia-container“Segfault caused by undefined behavior in nvc_ldcache.c”GitHub · May 23, 2025 · 6 reactions
The biggest 5 of 13 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 13
Talked about on GitHub and Bluesky (13 times).
On GitHub · 12
- Apr 11, 2023Support run tabby without docker — TabbyML/tabby12 reactions · 1 comment
- Nov 9, 2024bug(nvidia-container-toolkit): incorrect `containerd` config — awslabs/amazon-eks-ami10 reactions · 3 comments
- Oct 14, 2020Failures on Debian with `ldconfig` — NVIDIA/nvidia-docker8 reactions · 47 comments
- Jul 24, 2023`docker-compose`: Passing gpu with `driver: cdi` is not supported — podman-container-tools/podman7 reactions · 40 comments
- May 23, 2025Segfault caused by undefined behavior in nvc_ldcache.c — NVIDIA/libnvidia-container6 reactions · 5 comments
7 more on GitHub
- May 31, 2024Troubleshoot Guide: Run with WSL (Windows) — NVlabs/FoundationPose6 reactions · 6 comments
- Mar 1, 2023GPU access — dagger/dagger6 reactions · 32 comments
- Dec 4, 2025docker: nvidia container runtime (--gpus all) broken on NixOS 25.11 and master — NixOS/nixpkgs4 reactions · 12 comments
- May 16, 2025Do not discard container flags when --cuda-compat-mode is not specified — NVIDIA/libnvidia-container4 reactions
- Nov 11, 2025"linux: clarify pids cgroup settings" is causing widespread difficulty in adopting runtime-spec 1.3.0 — opencontainers/runtime-spec3 reactions · 8 comments
- Feb 27, 2025Missing confing file in `/etc/ld.so.conf.d/` pointing to `/lib64` causing the ldconfig caches wrong glibc and broken the k8s-device-plugin container img — NVIDIA/k8s-device-plugin3 reactions · 6 comments
- Oct 29, 2024How to join a nvidia GPU node in kubeedge — kubeedge/kubeedge3 reactions · 5 comments
On Bluesky · 1
- Dec 10, 2024With a nvidia GPU and some extra drivers, you seem to be able to run those computations on your gpu and make it even faster.… — @svrooij.io0 likes and reposts · 1 reply
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
15 rules. About 1 is common, 7 are distinctive, and 7 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 52
All standard tasks go through the Makefile.
- Very specific: line 64
Always run make build, make fmt and make test before considering Go changes complete.
- Distinctive: line 76
Keep changes scoped to the task.
- Distinctive: line 78
When adding new files, add the Apache 2.0 license header to the top of the file.
- Very specific: line 81
Follow existing patterns in cmds/, pkg, and internal/ for logging and error wrapping rather than introducing new libraries.
- Distinctive: line 96
When fixing a bug, add a regression test that fails without the fix.
- Very specific: line 104
All commits must be signed off (DCO): git commit -s, producing a trailing Signed-off-by: Name <email> line.
- Distinctive: line 107
Do not open, push to, or comment on GitHub issues/PRs without explicit user confirmation.
- Distinctive: line 109
Keep PR titles short and imperative.
- Common: line 114
Never commit credentials, API keys, tokens, passwords, kubeconfigs, or private keys.
- Very specific: line 116
Do not hand-edit generated files.
- Very specific: line 117
Run go mod tidy/go mod vendor after dependency changes and do not hand-edit vendored code.
- Very specific: line 119
Do not modify anything in third_party.
- Very specific: line 123
Do not commit built binaries, coverage.out, or anything the .gitignore already excludes.
- Distinctive: line 125
Do not modify CODEOWNERS or GOVERNANCE.md unless the task is explicitly about that.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Guidance for AI coding agents working in this repository. Human contributors should also read CONTRIBUTING.md and the documentation site which are the source of truth.
Project Summary
The NVIDIA Container Toolkit is a collection of utilities that allow you to run GPU-accelerated containers. It is designed to work with any container runtime, e.g. docker, containerd, cri-o, podman. It is written primarily in Go.
Historically, NVIDIA GPUs were injected into containers via an OCI
preStart hook.
The preStart hook would invoke the nvidia-container-cli which wraps the
NVIDIA Container Runtime library, libnvidia-container, written in C.
The preStart hook would discover GPUs on the host (during every container
startup) and perform a number of operations to make the requested GPU(s)
available in the container. Most of these operations, e.g. setting up cgroups
for devices, bind mounting files, are what low-level runtimes, like runc,
specialize in. This is the primary motivation for the development of the
Container Device Interface (CDI),
which provides a standard specification for defining "what" access to a device
means. Device vendors no longer need to write and maintain their own hooks to
enable device access. Instead, they define a CDI spec for their devices, and
runtime like runc take care of "injecting" devices based on the spec.
The NVIDIA Container Toolkit defaults to using CDI for enabling GPU
support in containers. Current and future development is focused on the
CDI-based implementation. The preStart hook-based implementation is not
leveraged by default, but users can opt-in to using it by configuring
NVIDIA Container Toolkit to run in legacy mode.
Repository layout
cmd/— binary entrypoints.internal/— private modules shared across commands.pkg/— public modules intended for broader reuse.api/— versioned config schema types.tests/— integration and e2e tests; this is a separate Go module (tests/go.mod) from the root module.packaging/—.deb/.rpmpackaging metadata.deployments/— container/systemd/udev artifacts and thedevelbuild image used bymake docker-*targets.hack/,scripts/— release and CI helper scripts.third_party/— vendored submodules; treat as upstream, not project code.testdata/— data used for unit tests.
Build, test, and lint
All standard tasks go through the Makefile. Prefer make targets over invoking tools directly so CI and local runs stay consistent.
make build # go build ./...
make cmds # build all cmd/ binaries
make test # run unit tests
make lint # golangci-lint run ./... (config is in .golangci.yml)
make fmt # gofmt -s -l -w
make goimports # goimports -local github.com/NVIDIA/nvidia-container-toolkitAlways run make build, make fmt and make test before considering Go
changes complete.
Any make <target> can be run inside the project's build container instead
of on the host with make docker-<target> (e.g. make docker-test,
make docker-lint) — this matches the environment CI uses, so prefer it if
local Go/golangci-lint versions are in doubt.
Coding conventions
- Comments explain why, not what. Identifier names should carry the "what."
- Keep changes scoped to the task. No drive-by refactors, speculative abstractions, or unrelated formatting churn — one concern per PR.
- When adding new files, add the Apache 2.0 license header to the top of the file. Match the header used in other files exactly rather than inventing a variant.
- Follow existing patterns in
cmds/,pkg, andinternal/for logging and error wrapping rather than introducing new libraries. - Vendor directory (
vendor/) is checked in; rungo mod tidy/go mod vendorafter dependency changes and do not hand-edit vendored code. - Mocks are generated (files end in
_mock.go); don't hand-edit generated mocks — regenerate viamake generate(go generate ./...) instead. - Standard Go formatting (
gofmt -s -l -w) and import grouping viagoimports -local github.com/NVIDIA/nvidia-container-toolkit.
Testing conventions
- Unit tests are co-located
*_test.gofiles usingtestify(require/assert), typically table-driven with amap[string]struct{...}of cases andt.Run(name, ...). Run viamake test. New behavior needs appropriate test coverage. - When fixing a bug, add a regression test that fails without the fix.
Contribution process (see CONTRIBUTING.md)
- For any significant change (architectural change, new feature, breaking change, non-trivial bug fix), an issue should exist describing the problem/proposal before implementation begins — check for or ask about a linked issue rather than assuming a PR alone is sufficient.
- All commits must be signed off (DCO):
git commit -s, producing a trailingSigned-off-by: Name <email>line. Do not fabricate a sign-off identity — use the configured git user's identity. - Do not open, push to, or comment on GitHub issues/PRs without explicit user confirmation.
- Keep PR titles short and imperative; the body should explain motivation ("why"), not just restate the diff.
Things to avoid
- Never commit credentials, API keys, tokens, passwords, kubeconfigs, or private keys.
- Do not hand-edit generated files. Run
make generateto regenerate Go mocks. Rungo mod tidy/go mod vendorafter dependency changes and do not hand-edit vendored code. - Do not modify anything in
third_party. These are vendored Git submodules that track upstream repos, namelylibnvidia-container. If a change is required in a Git submodule, a separate PR needs to be raised against that repository. - Do not commit built binaries,
coverage.out, or anything the .gitignore already excludes. - Do not modify CODEOWNERS or GOVERNANCE.md unless the task is explicitly about that.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

