From ae3e29ce93ae00d8a60128567aa7096da9eb4017 Mon Sep 17 00:00:00 2001 From: Alexander Jung Date: Sat, 2 Jan 2021 17:45:34 +0100 Subject: [PATCH] run/runner: save rootfs to structure Signed-off-by: Alexander Jung --- run/runner.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/run/runner.go b/run/runner.go index 87014b3..8fddeb8 100644 --- a/run/runner.go +++ b/run/runner.go @@ -79,6 +79,7 @@ type Runner struct { container libcontainer.Container timer time.Time out *[]Output + rootfs string } type Input struct { @@ -149,11 +150,11 @@ func (r *Runner) Init(in *[]Input, out *[]Output, dryRun bool) error { r.log.Debugf("Pulled: %s", digest) - rootfs := path.Join(r.Config.CacheDir, "rootfs", r.log.Prefix) + r.rootfs = path.Join(r.Config.CacheDir, "rootfs", r.log.Prefix) // Extract the image to the desired location - r.log.Infof("Extracting image to: %s", rootfs) - err = UnpackImage(image, r.Config.CacheDir, rootfs, r.Config.AllowOverride) + r.log.Infof("Extracting image to: %s", r.rootfs) + err = UnpackImage(image, r.Config.CacheDir, r.rootfs, r.Config.AllowOverride) if err != nil { return fmt.Errorf("Could not extract image: %s", err) } @@ -175,7 +176,7 @@ func (r *Runner) Init(in *[]Input, out *[]Output, dryRun bool) error { } config := &configs.Config{ - Rootfs: rootfs, + Rootfs: r.rootfs, Capabilities: &configs.Capabilities{ Bounding: defaultCapabilities, Effective: defaultCapabilities, @@ -352,7 +353,7 @@ func (r *Runner) Init(in *[]Input, out *[]Output, dryRun bool) error { // Set the argument as either the path or the cmd of the run if r.Config.Cmd != "" { entrypoint := path.Join("root", "entrypoint.sh") - entrypointPath := path.Join(rootfs, entrypoint) + entrypointPath := path.Join(r.rootfs, entrypoint) f, err := os.OpenFile( entrypointPath,