agentleFS
NVIDIAKnown publisherNVIDIA/nvidia-container-toolkit/AGENTS.md

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

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the NVIDIA/nvidia-container-toolkit repository that our weekly crawl found: only 13 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about NVIDIA/nvidia-container-toolkit

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

7 more on GitHub
  • 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
  1. Distinctive:

    All standard tasks go through the Makefile.

    line 52
  2. Very specific:

    Always run make build, make fmt and make test before considering Go changes complete.

    line 64
  3. Distinctive:

    Keep changes scoped to the task.

    line 76
  4. Distinctive:

    When adding new files, add the Apache 2.0 license header to the top of the file.

    line 78
  5. Very specific:

    Follow existing patterns in cmds/, pkg, and internal/ for logging and error wrapping rather than introducing new libraries.

    line 81
  6. Distinctive:

    When fixing a bug, add a regression test that fails without the fix.

    line 96
  7. Very specific:

    All commits must be signed off (DCO): git commit -s, producing a trailing Signed-off-by: Name <email> line.

    line 104
  8. Distinctive:

    Do not open, push to, or comment on GitHub issues/PRs without explicit user confirmation.

    line 107
  9. Distinctive:

    Keep PR titles short and imperative.

    line 109
  10. Common:

    Never commit credentials, API keys, tokens, passwords, kubeconfigs, or private keys.

    line 114
  11. Very specific:

    Do not hand-edit generated files.

    line 116
  12. Very specific:

    Run go mod tidy/go mod vendor after dependency changes and do not hand-edit vendored code.

    line 117
  13. Very specific:

    Do not modify anything in third_party.

    line 119
  14. Very specific:

    Do not commit built binaries, coverage.out, or anything the .gitignore already excludes.

    line 123
  15. Distinctive:

    Do not modify CODEOWNERS or GOVERNANCE.md unless the task is explicitly about that.

    line 125

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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/.rpm packaging metadata.
  • deployments/ — container/systemd/udev artifacts and the devel build image used by make 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-toolkit

Always 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, and internal/ for logging and error wrapping rather than introducing new libraries.
  • Vendor directory (vendor/) is checked in; run go mod tidy/go mod vendor after dependency changes and do not hand-edit vendored code.
  • Mocks are generated (files end in _mock.go); don't hand-edit generated mocks — regenerate via make generate (go generate ./...) instead.
  • Standard Go formatting (gofmt -s -l -w) and import grouping via goimports -local github.com/NVIDIA/nvidia-container-toolkit.

Testing conventions

  • Unit tests are co-located *_test.go files using testify (require/assert), typically table-driven with a map[string]struct{...} of cases and t.Run(name, ...). Run via make 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 trailing Signed-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 generate to regenerate Go mocks. Run go mod tidy/go mod vendor after 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, namely libnvidia-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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.