In this lesson, we will look at how to set restart policies for containers, and how that will effect their behavior when the docker service is restarted.
To configure the restart policy for a container, use the --restart flag:
no: Do not automatically restart the container. (the default) on-failure: Restart the container if it exits due to an error, which manifests as a non-zero exit code. always: Always restart the container if it stops. unless-stopped: Similar to always, except that when the container is stopped, it is not restarted even after the Docker daemon restarts.