Skip to content

Commit d63099c

Browse files
committed
Allow matching shim path side by side with containerd
Signed-off-by: Justin Terry (VM) <[email protected]>
1 parent 764afa0 commit d63099c

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

runtime/v2/shim/util.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,19 @@ func Command(ctx context.Context, runtime, containerdAddress, path string, cmdAr
6363
if cmdPath, lerr = exec.LookPath(name); lerr != nil {
6464
if eerr, ok := lerr.(*exec.Error); ok {
6565
if eerr.Err == exec.ErrNotFound {
66-
return nil, errors.Wrapf(os.ErrNotExist, "runtime %q binary not installed %q", runtime, name)
66+
// LookPath only finds current directory matches based on
67+
// the callers current directory but the caller is not
68+
// likely in the same directory as the containerd
69+
// executables. Instead match the calling binaries path
70+
// (containerd) and see if they are side by side. If so
71+
// execute the shim found there.
72+
testPath := filepath.Join(filepath.Dir(self), name)
73+
if _, serr := os.Stat(testPath); serr == nil {
74+
path = testPath
75+
}
76+
if path == "" {
77+
return nil, errors.Wrapf(os.ErrNotExist, "runtime %q binary not installed %q", runtime, name)
78+
}
6779
}
6880
}
6981
}

vendor.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c
3333
github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
3434
github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0
3535
github.com/Microsoft/go-winio v0.4.11
36-
github.com/Microsoft/hcsshim v0.8.4
36+
github.com/Microsoft/hcsshim v0.8.5
3737
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
3838
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
3939
github.com/containerd/ttrpc f02858b1457c5ca3aaec3a0803eb0d59f96e41d6

vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs.go

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)