mirror of
https://github.com/containers/podman.git
synced 2025-10-16 02:32:55 +08:00
generate systemd: use --cidfile again
Commit 9ac5267 changed the type of the generated systemd units from `forking` to `notify`. It further stopped using `--cidfile` and instead intended systemd to take care of stopping the container, which turned out to be a bad idea. Systemd will send the stop/kill signals to conmon which in turn may exit non-zero, depending on the signal, and ultimately breaking container cleanup. Hence, we need to use --cidfile again and let podman stop and remove the container to make sure that everything's in order. Fixes: #11304 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -233,9 +233,10 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
|
||||
info.Type = "notify"
|
||||
info.NotifyAccess = "all"
|
||||
info.PIDFile = ""
|
||||
info.ContainerIDFile = ""
|
||||
info.ExecStop = ""
|
||||
info.ExecStopPost = ""
|
||||
info.ContainerIDFile = "%t/%n.ctr-id"
|
||||
info.ExecStartPre = "/bin/rm -f {{{{.ContainerIDFile}}}}"
|
||||
info.ExecStop = "{{{{.Executable}}}} stop --ignore --cidfile={{{{.ContainerIDFile}}}}"
|
||||
info.ExecStopPost = "{{{{.Executable}}}} rm -f --ignore --cidfile={{{{.ContainerIDFile}}}}"
|
||||
// The create command must at least have three arguments:
|
||||
// /usr/bin/podman run $IMAGE
|
||||
index := 0
|
||||
@ -258,6 +259,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
|
||||
}
|
||||
startCommand = append(startCommand,
|
||||
"run",
|
||||
"--cidfile={{{{.ContainerIDFile}}}}",
|
||||
"--cgroups=no-conmon",
|
||||
"--rm",
|
||||
)
|
||||
|
Reference in New Issue
Block a user