mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
Merge pull request #19676 from rhatdan/pod
use container restart policy if user specifies one
This commit is contained in:
@ -588,7 +588,7 @@ func createContainerOptions(rt *libpod.Runtime, s *specgen.SpecGenerator, pod *l
|
|||||||
retries uint
|
retries uint
|
||||||
)
|
)
|
||||||
// If the container is running in a pod, use the pod's restart policy for all the containers
|
// If the container is running in a pod, use the pod's restart policy for all the containers
|
||||||
if pod != nil && !s.IsInitContainer() {
|
if pod != nil && !s.IsInitContainer() && s.RestartPolicy == "" {
|
||||||
podConfig := pod.ConfigNoCopy()
|
podConfig := pod.ConfigNoCopy()
|
||||||
if podConfig.RestartRetries != nil {
|
if podConfig.RestartRetries != nil {
|
||||||
retries = *podConfig.RestartRetries
|
retries = *podConfig.RestartRetries
|
||||||
|
@ -577,6 +577,21 @@ io.max | $lomajmin rbps=1048576 wbps=1048576 riops=max wiops=max
|
|||||||
run_podman 1 pod exists $podname
|
run_podman 1 pod exists $podname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman pod create restart tests" {
|
||||||
|
podname=pod$(random_string)
|
||||||
|
|
||||||
|
run_podman pod create --restart=on-failure --name $podname
|
||||||
|
run_podman create --name test-ctr --pod $podname $IMAGE
|
||||||
|
run_podman container inspect --format '{{ .HostConfig.RestartPolicy.Name }}' test-ctr
|
||||||
|
is "$output" "on-failure" "container inherits from pod"
|
||||||
|
|
||||||
|
run_podman create --replace --restart=always --name test-ctr --pod $podname $IMAGE
|
||||||
|
run_podman container inspect --format '{{ .HostConfig.RestartPolicy.Name }}' test-ctr
|
||||||
|
is "$output" "always" "container overrides restart policy from pod"
|
||||||
|
|
||||||
|
run_podman pod rm -f -a
|
||||||
|
}
|
||||||
|
|
||||||
# Helper used by pod ps --filter test. Creates one pod or container
|
# Helper used by pod ps --filter test. Creates one pod or container
|
||||||
# with a UNIQUE two-character CID prefix.
|
# with a UNIQUE two-character CID prefix.
|
||||||
function thingy_with_unique_id() {
|
function thingy_with_unique_id() {
|
||||||
|
Reference in New Issue
Block a user