diff options
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r-- | libpod/runtime_ctr.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index f9b5c5c51..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) } @@ -366,6 +373,10 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai ctr.config.ConmonPidFile = filepath.Join(ctr.state.RunDir, "conmon.pid") } + if ctr.config.PidFile == "" { + ctr.config.PidFile = filepath.Join(ctr.state.RunDir, "pidfile") + } + // Go through named volumes and add them. // If they don't exist they will be created using basic options. // Maintain an array of them - we need to lock them later. |