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

Cerrado
#2,155 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@blacksoxx ya está trabajando en esto.

Desde el 20/10/2026.

  • #2156 de @blacksoxx — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
docker, go
Área
devtools

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)
Lenguaje dominante
Go
Estrellas
4.6k
Forks
612
Merge medio
3 d 8 h
PR fusionados (30 d)
36

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NVIDIA/nvidia-container-toolkit

Todos los issues de NVIDIA/nvidia-container-toolkit

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.