Workaround to avoid 5 second delay on graceful daemon restart

Signed-off-by: Solomon Hykes <solomon@docker.com>
Extract log utils into pkg/log

Docker-DCO-1.1-Signed-off-by: Josiah Kiehl <josiah@capoferro.net> (github: capoferro)
move utils.Fataler to pkg/log.Fataler

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Merge pull request #7572 from shykes/workaround-api-shutdown

Workaround to avoid 5 second delay on graceful daemon restart
Merge pull request #7569 from erikh/pkg_log

Cleanup: Extract log utils into pkg/log
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>