mirror of https://github.com/containers/podman.git
Merge pull request #19704 from rhatdan/timeout
Set StopTimeout for compat API if not set by client
This commit is contained in:
commit
584c1e70d0
|
@ -435,6 +435,7 @@ func cliOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*entities.C
|
|||
Rm: cc.HostConfig.AutoRemove,
|
||||
SecurityOpt: cc.HostConfig.SecurityOpt,
|
||||
StopSignal: cc.Config.StopSignal,
|
||||
StopTimeout: rtc.Engine.StopTimeout, // podman default
|
||||
StorageOpts: stringMaptoArray(cc.HostConfig.StorageOpt),
|
||||
Sysctl: stringMaptoArray(cc.HostConfig.Sysctls),
|
||||
Systemd: "true", // podman default
|
||||
|
|
|
@ -65,6 +65,10 @@ func (ic *ContainerEngine) createServiceContainer(ctx context.Context, name stri
|
|||
return nil, fmt.Errorf("image for service container: %w", err)
|
||||
}
|
||||
|
||||
rtc, err := ic.Libpod.GetConfigNoCopy()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ctrOpts := entities.ContainerCreateOptions{
|
||||
// Inherited from infra containers
|
||||
ImageVolume: define.TypeBind,
|
||||
|
@ -73,7 +77,8 @@ func (ic *ContainerEngine) createServiceContainer(ctx context.Context, name stri
|
|||
ReadOnly: true,
|
||||
ReadWriteTmpFS: false,
|
||||
// No need to spin up slirp etc.
|
||||
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
|
||||
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
|
||||
StopTimeout: rtc.Engine.StopTimeout,
|
||||
}
|
||||
|
||||
// Create and fill out the runtime spec.
|
||||
|
|
|
@ -308,6 +308,7 @@ cid_top=$(jq -r '.Id' <<<"$output")
|
|||
t GET containers/${cid_top}/json 200 \
|
||||
.Config.Entrypoint[0]="top" \
|
||||
.Config.Cmd='[]' \
|
||||
.Config.StopTimeout="10" \
|
||||
.Path="top" \
|
||||
.NetworkSettings.Networks.podman.NetworkID=podman
|
||||
t POST containers/${cid_top}/start 204
|
||||
|
|
|
@ -206,6 +206,9 @@ EOF
|
|||
run_podman container inspect $service_container --format "{{.State.Running}}"
|
||||
is "$output" "true"
|
||||
|
||||
run_podman container inspect $service_container --format '{{.Config.StopTimeout}}'
|
||||
is "$output" "10" "StopTimeout should be initialized to 10"
|
||||
|
||||
# Stop the *main* container and make sure that
|
||||
# 1) The pod transitions to Exited
|
||||
# 2) The service container is stopped
|
||||
|
|
Loading…
Reference in New Issue