Introduction
When a container crashes or the host machine reboots, Docker does not restart it by default. Restart policies tell Docker what to do automatically — whether to always restart, restart only on failure, or never restart.
When you run a web server that must stay running even if it crashes unexpectedly.
When you want containers to start automatically after a host server reboot.
When you run background workers and want them restarted only if they exit with an error.
When you run one-time task containers and want to make sure they never restart after completing.
When you deploy long-running services in production that must self-heal without manual intervention.