Editing Docker start configuration behavior and restart policy
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 9: | Line 9: | ||
The following example starts a Redis container and configures it to always restart unless it is explicitly stopped or Docker is restarted: | The following example starts a Redis container and configures it to always restart unless it is explicitly stopped or Docker is restarted: | ||
− | <code>$ | + | <code>$ docker run -dit --restart '''unless-stopped''' redis</code> |
With <code>[[docker inspect]] CONTAINER</code><ref>https://stackoverflow.com/questions/43108227/is-it-possible-to-show-the-restart-policy-of-a-running-docker-container</ref> you can verify <code>RestartPolicy</code> configuration. | With <code>[[docker inspect]] CONTAINER</code><ref>https://stackoverflow.com/questions/43108227/is-it-possible-to-show-the-restart-policy-of-a-running-docker-container</ref> you can verify <code>RestartPolicy</code> configuration. | ||
To update restart policy execute: | To update restart policy execute: | ||
− | :<code>[[docker update]]</code><ref>https://docs.docker.com/engine/reference/commandline/update/</ref | + | :<code>[[/docker update/]]</code><ref>https://docs.docker.com/engine/reference/commandline/update/</ref> --restart=always CONTAINER_ID|CONTAINER_NAME<ref>docker update --restart=always 90bf248337dc</ref> |
: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. | :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. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== See also == | == See also == | ||
− | * | + | * [[docker inspect]] |
*{{Docker}} | *{{Docker}} | ||
− | |||
[[Category:Docker]] | [[Category:Docker]] | ||
− | [[Category: | + | [[Category:Devops]] |
Advertising: