support relative rootfs path in ctr
Signed-off-by: Lifubang <lifubang@aliyun.com>
This commit is contained in:
parent
830363acac
commit
dc6ed04ff5
@ -20,6 +20,7 @@ package run
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
gocontext "context"
|
gocontext "context"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
@ -61,7 +62,11 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
|||||||
opts = append(opts, withMounts(context))
|
opts = append(opts, withMounts(context))
|
||||||
|
|
||||||
if context.Bool("rootfs") {
|
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 {
|
} else {
|
||||||
snapshotter := context.String("snapshotter")
|
snapshotter := context.String("snapshotter")
|
||||||
image, err := client.GetImage(ctx, ref)
|
image, err := client.GetImage(ctx, ref)
|
||||||
|
Loading…
Reference in New Issue
Block a user