diff --git a/cmd/ctr/commands/run/run_unix.go b/cmd/ctr/commands/run/run_unix.go index ac22078f0..29abf15fe 100644 --- a/cmd/ctr/commands/run/run_unix.go +++ b/cmd/ctr/commands/run/run_unix.go @@ -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)