Manage the lifecycle of existing containers: stop and start them without losing their state, restart them, or remove them for good.
created → running → paused / exited → removed. Stopping keeps the container (and its writable layer) on disk; removing deletes it.
| Policy | Behaviour |
|---|---|
no (default) | Never restart automatically |
on-failure[:N] | Restart on non-zero exit, optionally max N times |
always | Always restart, also after daemon restart |
unless-stopped | Like always, but not if you stopped it manually |
docker rm -f kills without a graceful shutdown; databases may need recovery. Prefer stop first.