Skip to content

Commit d78d883

Browse files
committed
Fix the --runtime option of container create is ignored
Signed-off-by: Kay Yan <[email protected]>
1 parent 9cd00de commit d78d883

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cmd/nerdctl/compose_up_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ services:
4646
c := base.ComposeCmd("-f", comp.YAMLFullPath(), "up", "-d")
4747
expected := icmd.Expected{
4848
ExitCode: 1,
49-
Err: `exec: \"invalid\": executable file not found in $PATH`,
49+
Err: `failed to resolve runtime path: invalid runtime name invalid`,
5050
}
5151
if base.Target == testutil.Docker {
5252
expected.Err = `Unknown runtime specified invalid`

pkg/cmd/container/run_runtime.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package container
1818

1919
import (
2020
"context"
21+
"path/filepath"
2122
"strings"
2223

2324
"github.com/containerd/containerd"
@@ -47,6 +48,9 @@ func generateRuntimeCOpts(cgroupManager, runtimeStr string) ([]containerd.NewCon
4748
}
4849
runtimeOpts = nil
4950
}
51+
} else if filepath.IsAbs(runtimeStr) {
52+
// runtimeStr is absolute path to runtime binary
53+
runtime = runtimeStr
5054
} else {
5155
// runtimeStr is a runc binary
5256
runcOpts.BinaryName = runtimeStr

0 commit comments

Comments
 (0)