diff --git a/util/types.go b/util/types.go index dc5f4b6c8e7..49f4989cae1 100644 --- a/util/types.go +++ b/util/types.go @@ -1,8 +1,9 @@ package util const ( - // DefaultRuntime is the default command to use to run the container. - DefaultRuntime = "runc" + // DefaultRuntime should no longer be used. + // Default runtime should come from containers.conf + DefaultRuntime = "crun" // DefaultCNIPluginPath is the default location of CNI plugin helpers. DefaultCNIPluginPath = "/usr/libexec/cni:/opt/cni/bin" // DefaultCNIConfigDir is the default location of CNI configuration files. diff --git a/util/util.go b/util/util.go index 99f68d9e1ce..5b512a4540e 100644 --- a/util/util.go +++ b/util/util.go @@ -260,10 +260,15 @@ func Runtime() string { // Need to switch default until runc supports cgroups v2 if unified, _ := IsCgroup2UnifiedMode(); unified { - return "crun" + return } - return DefaultRuntime + conf, err := config.Default() + if err != nil { + logrus.Debugf("Error loading container config when searching for local runtime.") + return "DefaultRuntime" + } + return conf.Engine.OCIRuntime } // StringInSlice returns a boolean indicating if the exact value s is present