What are common restart policy options?

Common restart policy options for containers, particularly in Docker, include:

  1. no: The container will not be restarted automatically. This is the default setting.

  2. always: The container will always restart unless it is explicitly stopped. This is useful for long-running services.

  3. 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.

  4. 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.

0 Comments

no data
Be the first to share your comment!