From a35e16c23456a8fba8d2f627ac64f647aa6f0722 Mon Sep 17 00:00:00 2001 From: chenkang Date: Sun, 18 Apr 2021 00:02:50 +0800 Subject: support pidfile on container restore Signed-off-by: chenkang --- libpod/runtime_ctr.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 6290479a8..0acf88cbc 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -69,6 +69,13 @@ func (r *Runtime) RestoreContainer(ctx context.Context, rSpec *spec.Spec, config ctr.config.ConmonPidFile = "" } + // If the path to PidFile starts with the default value (RunRoot), then + // the user has not specified '--pidfile' during run or create (probably). + // In that case reset PidFile to be set to the default value later. + if strings.HasPrefix(ctr.config.PidFile, r.storageConfig.RunRoot) { + ctr.config.PidFile = "" + } + return r.setupContainer(ctx, ctr) } -- cgit v1.2.3-54-g00ecf