Start containers automatically | ubuntu upstart docker
Dockerprovidesrestartpolicies[1]tocontrolwhetheryourcontainersstartautomaticallywhentheyexit,orwhenDockerrestarts.Restartpoliciesensurethatlinkedcontainersarestartedinthecorrectorder.Dockerrecommendsthatyouuserestartpolicies,andavoidusingprocessmanagerstostartcontainers.Restartpoliciesaredifferentfromthe--live-restoreflagofthedockerdcommand.Using--live-restoreallowsyoutokeepyourcontainersrunningduringaDockerupgrade,thoughnetworkinganduserinputareinterrupted.UsearestartpolicyToconfiguretheres...
Docker provides restart policies[1] to control whether your containers start automatically when they exit, or when Docker restarts. Restart policies ensure that linked containers are started in the correct order. Docker recommends that you use restart policies, and avoid using process managers to start containers.
Restart policies are different from the --live-restore flag of the dockerd command. Using --live-restore allows you to keep your containers running during a Docker upgrade, though networking and user input are interrupted.
Use a restart policyTo configure the restart policy for a container, use the --restart flag when using the docker run command. The value of the --restart flag can be any of the following:
Flag Description no Do not automatically restart the container. (the default) on-failure[:max-retries] Restart the container if it exits due to an error, which manifests as a non-zero exit cod...