DevOps/Docker/Start configuration behavior and restart policy

To configure the start configuration behavior or the restart policy for a container (both of them), use the  flag when using the   command. The value of the  flag can be any of the following:


 * Do not automatically restart the container. (the default):
 * Restart the container if it exits due to an error, which manifests as a non-zero exit code:
 * Restart the container unless it is explicitly stopped or Docker itself is stopped or restarted:
 * Always restart the container if it stops:

The following example starts a Redis container and configures it to always restart unless it is explicitly stopped or Docker is restarted:

With you can verify   configuration.

To update restart policy execute:
 * --restart=always CONTAINER_ID|CONTAINER_NAME
 * If the container is started with “--rm” flag, you cannot update the restart policy for it. The AutoRemove and RestartPolicy are mutually exclusive for the container.