libpod: cleanup store at shutdown
shutdown the containers store so that the home directory mount is not leaked when "podman system service" exits. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
317a88ee4e
commit
6832a35f65
|
|
@ -210,7 +210,14 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
|
|||
}
|
||||
}
|
||||
|
||||
if err := makeRuntime(ctx, runtime); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := shutdown.Register("libpod", func(sig os.Signal) error {
|
||||
if runtime.store != nil {
|
||||
_, _ = runtime.store.Shutdown(false)
|
||||
}
|
||||
// For `systemctl stop podman.service` support, exit code should be 0
|
||||
if sig == syscall.SIGTERM {
|
||||
os.Exit(0)
|
||||
|
|
@ -225,10 +232,6 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
|
|||
return nil, fmt.Errorf("starting shutdown signal handler: %w", err)
|
||||
}
|
||||
|
||||
if err := makeRuntime(ctx, runtime); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
runtime.config.CheckCgroupsAndAdjustConfig()
|
||||
|
||||
return runtime, nil
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ run_podman --noout system connection ls
|
|||
run_podman --log-level=debug run --rm $IMAGE true
|
||||
is "$output" ".*Shutting down engines.*"
|
||||
run_podman 125 --log-level=debug run dockah://rien.de/rien:latest
|
||||
is "${lines[-1]}" ".*Shutting down engines"
|
||||
is "$output" ".*Shutting down engines.*"
|
||||
}
|
||||
|
||||
# vim: filetype=sh
|
||||
|
|
|
|||
Loading…
Reference in New Issue