From 4ece83bdf92b794944b8760086560709630f11e4 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 29 May 2024 11:09:06 +0200 Subject: [PATCH] libpod: cleanup default cache on system reset Closes: https://github.com/containers/podman/issues/22825 Signed-off-by: Giuseppe Scrivano --- libpod/reset.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libpod/reset.go b/libpod/reset.go index 955fcdff2d..c223aeb5df 100644 --- a/libpod/reset.go +++ b/libpod/reset.go @@ -11,6 +11,7 @@ import ( "github.com/containers/common/libimage" "github.com/containers/common/libnetwork/types" + blobinfocache "github.com/containers/image/v5/pkg/blobinfocache" "github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/pkg/errorhandling" "github.com/containers/podman/v5/pkg/util" @@ -257,6 +258,14 @@ func (r *Runtime) Reset(ctx context.Context) error { prevError = err } } + + if err := blobinfocache.CleanupDefaultCache(nil); err != nil { + if prevError != nil { + logrus.Error(prevError) + } + prevError = err + } + if storageConfPath, err := storage.DefaultConfigFile(); err == nil { switch storageConfPath { case stypes.SystemConfigFile: