support relative rootfs path in ctr

Signed-off-by: Lifubang <lifubang@aliyun.com>
This commit is contained in:
Lifubang 2018-08-24 07:56:37 +08:00
parent 830363acac
commit dc6ed04ff5

View File

@ -20,6 +20,7 @@ package run
import (
gocontext "context"
"path/filepath"
"strings"
"github.com/containerd/containerd"
@ -61,7 +62,11 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
opts = append(opts, withMounts(context))
if context.Bool("rootfs") {
opts = append(opts, oci.WithRootFSPath(ref))
rootfs, err := filepath.Abs(ref)
if err != nil {
return nil, err
}
opts = append(opts, oci.WithRootFSPath(rootfs))
} else {
snapshotter := context.String("snapshotter")
image, err := client.GetImage(ctx, ref)