ctr: improve error relative shim path error msg
addresses https://github.com/containerd/containerd/issues/6464 Return an error if a runtime provided is relative. Add context to the usage for `ctr run --runtime` indicating that absolute path to runtime binary must be provided. Signed-off-by: Gavin Inglis <giinglis@amazon.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/containerd/containers"
|
||||
@@ -244,6 +245,11 @@ func (m *ShimManager) resolveRuntimePath(runtime string) (string, error) {
|
||||
return runtime, nil
|
||||
}
|
||||
|
||||
// Check if relative path to runtime binary provided
|
||||
if strings.Contains(runtime, "/") {
|
||||
return "", fmt.Errorf("invalid runtime name %s, correct runtime name should be either format like `io.containerd.runc.v1` or a full path to the binary", runtime)
|
||||
}
|
||||
|
||||
// Preserve existing logic and resolve runtime path from runtime name.
|
||||
|
||||
name := shimbinary.BinaryName(runtime)
|
||||
|
||||
Reference in New Issue
Block a user