[Bug]: nvidia-ctk runtime configure --runtime=docker without --set-as-default leaves default-runtime set to nvidia

Closed
#2,155 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@blacksoxx is already working on this.

Since Oct 20, 2026.

  • #2156 by @blacksoxx — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
30/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
docker, go
Domain
devtools

Research direction

Start with pkg/config/engine/docker/docker.go and the existing Docker unit test for Config{"default-runtime": "nvidia"}.AddRuntime("nvidia", path, false). Compare the behavior with the containerd and cri-o changes from #1256. Done means the Docker configuration clears default-runtime in this case and the unit test verifies it; pull request #2156 is already open for this fix.

Written by the indexing model from the issue text.

Description

Describe the bug

#1256 (cab76e2d) changed AddRuntime for containerd and cri-o to clear the default runtime when the runtime being added is the current default and setAsDefault is false. The docker implementation in pkg/config/engine/docker/docker.go was not changed: it only sets default-runtime when setAsDefault is true and leaves an existing value alone otherwise.

So after the NVIDIA runtime was made the docker default once (--set-as-default, or the toolkit container with set-as-default enabled), configuring it again with set-as-default off keeps "default-runtime": "nvidia" in daemon.json, and every docker container keeps running through the NVIDIA runtime. With the same steps, containerd and cri-o go back to their own default.

To Reproduce

Found by reading the code and confirmed with a unit test on main (44f1c6ef): Config{"default-runtime": "nvidia"}.AddRuntime("nvidia", path, false) leaves default-runtime as nvidia.

Expected on a host (not run):

  1. nvidia-ctk runtime configure --runtime=docker --set-as-default
  2. nvidia-ctk runtime configure --runtime=docker
  3. /etc/docker/daemon.json still has "default-runtime": "nvidia".

Expected behavior

Docker behaves like containerd and cri-o: when the runtime being configured is the current default and set-as-default is off, default-runtime is removed and docker falls back to its own default (runc).

One thing for the maintainers to decide: this changes behaviour for anyone who set default-runtime: nvidia by hand and later runs nvidia-ctk runtime configure --runtime=docker without --set-as-default. That is the same trade-off #1256 made for containerd and cri-o, but it may matter more for docker users. A fix that mirrors #1256 is in #2156.

Environment (please provide the following information):

  • NVIDIA Container Toolkit version: main at 44f1c6ef; the same code is in v1.20.1
  • NVIDIA Driver Version, host OS, kernel, container runtime: not run on a host; reproduced with the pkg/config/engine/docker unit tests (Go 1.27.2, macOS arm64)
Dominant language
Go
Stars
4.6k
Forks
609
Avg merge
3d 18h
Merged PRs (30d)
37

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/nvidia-container-toolkit

All issues in NVIDIA/nvidia-container-toolkit

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.