diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-13 13:00:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 13:00:23 +0200 |
commit | c0dd0d696e333ad42a5fa3d9428fee27b1c30061 (patch) | |
tree | 6d20a847b4df3361c2f80bff59bed3a2e7e14a8a /pkg | |
parent | eb6925930533b2ea812551d107f69bdf16f1dd0a (diff) | |
parent | 0ea5080c9156853b7806879226e23ab0405815d6 (diff) | |
download | podman-c0dd0d696e333ad42a5fa3d9428fee27b1c30061.tar.gz podman-c0dd0d696e333ad42a5fa3d9428fee27b1c30061.tar.bz2 podman-c0dd0d696e333ad42a5fa3d9428fee27b1c30061.zip |
Merge pull request #15766 from vrothberg/fix-15284
generate systemd: warn on --restart without --new
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/systemd/generate/containers.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go index 0274dd7b7..8510cfd42 100644 --- a/pkg/systemd/generate/containers.go +++ b/pkg/systemd/generate/containers.go @@ -148,6 +148,18 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste return nil, errors.New("conmon PID file path is empty, try to recreate the container with --conmon-pidfile flag") } + // #15284: old units generated without --new can lead to issues on + // shutdown when the containers are created with a custom restart + // policy. + if !options.New { + switch config.RestartPolicy { + case libpodDefine.RestartPolicyNo, libpodDefine.RestartPolicyNone: + // All good + default: + logrus.Warnf("Container %s has restart policy %q which can lead to issues on shutdown: consider recreating the container without a restart policy and use systemd's restart mechanism instead", ctr.ID(), config.RestartPolicy) + } + } + createCommand := []string{} if config.CreateCommand != nil { createCommand = config.CreateCommand |