diff --git a/cmd/ctr/commands/commands.go b/cmd/ctr/commands/commands.go index 0d831f150..1208708e7 100644 --- a/cmd/ctr/commands/commands.go +++ b/cmd/ctr/commands/commands.go @@ -123,6 +123,10 @@ var ( Usage: "runtime name", Value: defaults.DefaultRuntime, }, + cli.StringFlag{ + Name: "runtime-config-path", + Usage: "optional runtime config path", + }, cli.BoolFlag{ Name: "tty,t", Usage: "allocate a TTY for the container", diff --git a/cmd/ctr/commands/run/run_unix.go b/cmd/ctr/commands/run/run_unix.go index 7ee1d9b2f..ef06288c6 100644 --- a/cmd/ctr/commands/run/run_unix.go +++ b/cmd/ctr/commands/run/run_unix.go @@ -30,6 +30,7 @@ import ( "github.com/containerd/containerd/contrib/nvidia" "github.com/containerd/containerd/contrib/seccomp" "github.com/containerd/containerd/oci" + crioptions "github.com/containerd/containerd/pkg/cri/runtimeoptions/v1" "github.com/containerd/containerd/platforms" "github.com/containerd/containerd/runtime/v2/runc/options" "github.com/opencontainers/runtime-spec/specs-go" @@ -302,6 +303,12 @@ func getRuntimeOptions(context *cli.Context) (interface{}, error) { return getRuncOptions(context) } + if configPath := context.String("runtime-config-path"); configPath != "" { + return &crioptions.Options{ + ConfigPath: configPath, + }, nil + } + return nil, nil }