diff --git a/tools/container/runtime/containerd/containerd.go b/tools/container/runtime/containerd/containerd.go index 6a5df5ad..14b0a5d3 100644 --- a/tools/container/runtime/containerd/containerd.go +++ b/tools/container/runtime/containerd/containerd.go @@ -25,6 +25,7 @@ import ( "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/containerd" + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/toml" "github.com/NVIDIA/nvidia-container-toolkit/tools/container" ) @@ -116,7 +117,12 @@ func Cleanup(c *cli.Context, o *container.Options, co *Options) error { cfg, err := containerd.New( containerd.WithPath(o.Config), - containerd.WithConfigSource(containerd.CommandLineSource(o.HostRootMount)), + containerd.WithConfigSource( + toml.LoadFirst( + containerd.CommandLineSource(o.HostRootMount), + toml.FromFile(o.Config), + ), + ), containerd.WithRuntimeType(co.runtimeType), containerd.WithUseLegacyConfig(co.useLegacyConfig), containerd.WithContainerAnnotations(co.containerAnnotationsFromCDIPrefixes()...), diff --git a/tools/container/runtime/crio/crio.go b/tools/container/runtime/crio/crio.go index e3fa77f6..68b36f45 100644 --- a/tools/container/runtime/crio/crio.go +++ b/tools/container/runtime/crio/crio.go @@ -28,6 +28,7 @@ import ( "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/crio" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/ocihook" + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/toml" "github.com/NVIDIA/nvidia-container-toolkit/tools/container" ) @@ -170,7 +171,12 @@ func cleanupConfig(o *container.Options) error { cfg, err := crio.New( crio.WithPath(o.Config), - crio.WithConfigSource(crio.CommandLineSource(o.HostRootMount)), + crio.WithConfigSource( + toml.LoadFirst( + crio.CommandLineSource(o.HostRootMount), + toml.FromFile(o.Config), + ), + ), ) if err != nil { return fmt.Errorf("unable to load config: %v", err)