Restart containers based on restart policy

Signed-off-by: Michael Crosby <michael@docker.com>
Cleanup restart logic in monitor

Signed-off-by: Michael Crosby <michael@docker.com>
Add typed RestartPolicy

Signed-off-by: Michael Crosby <michael@docker.com>
Refactor container monitor into type

Signed-off-by: Michael Crosby <michael@docker.com>
Add documentation and update restart rules.

Implement time backed backoff for restarting and fix failure count when
the maximum is 0

Signed-off-by: Michael Crosby <michael@docker.com>
Update docs based on feedback from review for --restart

Signed-off-by: Michael Crosby <michael@docker.com>
Only restart containers on daemon load with policy of always

Signed-off-by: Michael Crosby <michael@docker.com>
Restart conatiner with on-failure policy if exit code != 0

Signed-off-by: Michael Crosby <michael@docker.com>
Fix rebase around log event

Signed-off-by: Michael Crosby <michael@docker.com>
Move container start event into monitor

Signed-off-by: Michael Crosby <michael@docker.com>
Add additional comments for vague lines

Signed-off-by: Michael Crosby <michael@docker.com>
Add Restarting state when docker is handling the restart of containers

Signed-off-by: Michael Crosby <michael@docker.com>
Honor the restarting state in Stop

Signed-off-by: Michael Crosby <michael@docker.com>
Improve wait during restart

We need to do this so that when a user asks docker to stop the container
and it is currently in the restart loop we don't want to have to wait
for the duration of the restart time increment before ack. the stop.

Signed-off-by: Michael Crosby <michael@docker.com>
Reguardless of success reset time increment

Reset the time increment if the container's execution time is greater
than 10s or else as a container runs and is restarted the time will grow
overtime.

Signed-off-by: Michael Crosby <michael@docker.com>
Rebased changes to return on first start's error

Signed-off-by: Michael Crosby <michael@docker.com>
Update based on comments from the code review

Signed-off-by: Michael Crosby <michael@docker.com>
Deprecate --restart on the daemon

Signed-off-by: Michael Crosby <michael@docker.com>
Merge pull request #7414 from crosbymichael/auto-restart

Auto restart containers based on restart policy