From 3808067ff8626a897fc50ba030c954d6e600dec0 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 21 Dec 2022 10:24:47 +0100 Subject: [PATCH] When in transient store mode, use rundir for bundlepath This means we store things like config.json and the secret files also on tmpfs, lowering wear on disk and leaving less stuff on disk on an unclean shutdown. Signed-off-by: Alexander Larsson --- libpod/container_internal.go | 3 +++ libpod/container_internal_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index c3fee6552a..4ffd0e29a9 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -128,6 +128,9 @@ func (c *Container) rwSize() (int64, error) { // bundlePath returns the path to the container's root filesystem - where the OCI spec will be // placed, amongst other things func (c *Container) bundlePath() string { + if c.runtime.storageConfig.TransientStore { + return c.state.RunDir + } return c.config.StaticDir } diff --git a/libpod/container_internal_test.go b/libpod/container_internal_test.go index af3a5886c0..167ffabe64 100644 --- a/libpod/container_internal_test.go +++ b/libpod/container_internal_test.go @@ -118,6 +118,7 @@ func TestPostDeleteHooks(t *testing.T) { statePath := filepath.Join(dir, "state") copyPath := filepath.Join(dir, "copy") c := Container{ + runtime: &Runtime{}, config: &ContainerConfig{ ID: "123abc", Spec: &rspec.Spec{