📦Container Restart Policy
Also known as Restart Policy, docker run --restart, restart: unless-stopped
A rule for whether a stopped box should start up again.
Think of it like
Think of it like a toy that stands back up each time it falls over.
Example
Emma runs her app with --restart unless-stopped. The server reboots at night for updates, and the app is back up before anyone notices.
Why it matters
Without one, a crash or reboot leaves the app down until someone notices. It is the simplest way for a service to heal itself.
Definition
Example code
bash
docker run -d --restart unless-stopped --name app myappCommon mistake
Key takeaways
- 1Default is no. A stopped container stays stopped.
- 2Four choices. no, on-failure, always, unless-stopped.
- 3Back after reboots. always and unless-stopped return.