Skip to content

Commit

Permalink
Fix the --runtime option of container create is ignored
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Yan <kay.yan@daocloud.io>
  • Loading branch information
yankay committed Aug 8, 2023
1 parent 9cd00de commit d78d883
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/nerdctl/compose_up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ services:
c := base.ComposeCmd("-f", comp.YAMLFullPath(), "up", "-d")
expected := icmd.Expected{
ExitCode: 1,
Err: `exec: \"invalid\": executable file not found in $PATH`,
Err: `failed to resolve runtime path: invalid runtime name invalid`,
}
if base.Target == testutil.Docker {
expected.Err = `Unknown runtime specified invalid`
Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/container/run_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package container

import (
"context"
"path/filepath"
"strings"

"github.com/containerd/containerd"
Expand Down Expand Up @@ -47,6 +48,9 @@ func generateRuntimeCOpts(cgroupManager, runtimeStr string) ([]containerd.NewCon
}
runtimeOpts = nil
}
} else if filepath.IsAbs(runtimeStr) {
// runtimeStr is absolute path to runtime binary
runtime = runtimeStr
} else {
// runtimeStr is a runc binary
runcOpts.BinaryName = runtimeStr
Expand Down

0 comments on commit d78d883

Please sign in to comment.