Common restart policy options for containers, particularly in Docker, include:
-
no: The container will not be restarted automatically. This is the default setting.
-
always: The container will always restart unless it is explicitly stopped. This is useful for long-running services.
-
unless-stopped: The container will restart unless it is stopped manually. This is similar to
always, but it won't restart if the container was stopped by the user. -
on-failure: The container will restart only if it exits with a non-zero exit code. You can specify a maximum retry count, such as
on-failure:5, which means it will attempt to restart up to 5 times before giving up.
These options allow you to control the behavior of containers in response to failures or manual stops, enhancing the reliability of your applications.
