Thanks, that's very clear but do you have to configure it manually? I just killed a container and it was recreated but also killed instantly.
Error of the container:
[centos ip-10-0-0-xx ~]$ docker logs b24008661dc1
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.1.0.x. Set the 'ServerName' directive globally to suppress this message
From: rcarvalh redhat com
Date: Wed, 25 Nov 2015 14:50:58 +0100
Subject: Re: What if a container dies in OpenShift?
To: dencowboy hotmail com
CC: users lists openshift redhat comOn Wed, Nov 25, 2015 at 2:23 PM, Den Cowboy <dencowboy hotmail com> wrote:Hmm, okay so restartpolicty will be set 'always'. And when it's 'always' it will be defined by the replication controller. But the RC is only working on pod-level. So new pods will be recreated thanks to the RC. But the RC describes nothing about containers? So when A pod is still running but the container in it is dead, than there will happen nothing?
I'm sorry, I'm probably wrong but I do not understand it at the moment.
ThanksBy default the restartpolicy is set to always. That applies to both pods and their containers.Maybe I'll illustrate with an example I just ran locally:[vagrant openshiftdev ~]$ oc project defaultNow using project "default" on server "https://10.0.2.15:8443".[vagrant openshiftdev ~]$ oc get podsNAME READY STATUS RESTARTS AGEdocker-registry-1-mqqmk 1/1 Running 0 33s[vagrant openshiftdev ~]$ docker ps | grep registryef318d7839f8 openshift/origin-docker-registry:v1.1 "/bin/sh -c 'REGISTRY" 49 seconds ago Up 48 seconds k8s_registry.ea5217cb_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_18eb84e565e675979b64 openshift/origin-pod:v1.1 "/pod" 50 seconds ago Up 49 seconds k8s_POD.cc3ffd58_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_21e3cc20[vagrant openshiftdev ~]$ docker kill ef318d7839f8ef318d7839f8[vagrant openshiftdev ~]$ oc get podsNAME READY STATUS RESTARTS AGEdocker-registry-1-mqqmk 1/1 Running 1 1m[vagrant openshiftdev ~]$ docker ps | grep registryfd08b9cdfd90 openshift/origin-docker-registry:v1.1 "/bin/sh -c 'REGISTRY" 15 seconds ago Up 13 seconds k8s_registry.ea5217cb_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_0ab0a01365e675979b64 openshift/origin-pod:v1.1 "/pod" 2 minutes ago Up About a minute k8s_POD.cc3ffd58_docker-registry-1-mqqmk_default_64a5c92c-937a-11e5-b5a1-080027c5bfa9_21e3cc20I killed a container that was running my registry, and the container was restarted. Note that the container name changed, but the pod did not change.I don't know for sure about the implementation, but since Docker 1.2 there's an option to configure container restart policy.It's either that, or the statement "the RC is only working on pod-level" is not entirely true.Either way, you have a guarantee that pod and container restarts obey the same policy, set on the pod level.HTH,--Rodolfo Carvalho
OpenShift Developer Experience