From 0e949bfd374bea7679fd3d5c065a4a8c57eaaecd Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 27 Jan 2023 17:16:43 +0100 Subject: [PATCH] libpod: use GraphRoot for overlay upper dir Signed-off-by: Giuseppe Scrivano --- libpod/container_internal.go | 2 +- libpod/runtime.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index c37d6be2b1..5dab3122e3 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1527,7 +1527,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) { mountPoint := c.config.Rootfs // Check if overlay has to be created on top of Rootfs if c.config.RootfsOverlay { - overlayDest := c.runtime.RunRoot() + overlayDest := c.runtime.GraphRoot() contentDir, err := overlay.GenerateStructure(overlayDest, c.ID(), "rootfs", c.RootUID(), c.RootGID()) if err != nil { return "", fmt.Errorf("rootfs-overlay: failed to create TempDir in the %s directory: %w", overlayDest, err) diff --git a/libpod/runtime.go b/libpod/runtime.go index ece290f797..519c2d932a 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -973,6 +973,14 @@ func (r *Runtime) RunRoot() string { return r.store.RunRoot() } +// GraphRoot retrieves the current c/storage directory in use by Libpod. +func (r *Runtime) GraphRoot() string { + if r.store == nil { + return "" + } + return r.store.GraphRoot() +} + // GetName retrieves the name associated with a given full ID. // This works for both containers and pods, and does not distinguish between the // two.