What's the difference between docker restart_policy on-failure vs any

后端 未结 1 1197
生来不讨喜
生来不讨喜 2021-01-21 05:29

In the docker swarm v3 docs, there are 3 different restart policy conditions that can be used. It\'s obvious what the none condition does, but I was wondering what

相关标签:
1条回答
  • 2021-01-21 05:48

    The on-failure policy handles any time a container exist with a non-zero code. The any policy covers any other scenarios, but may only be handled on daemon restart depending on how the container was stopped (e.g. intentionally stopping a container with docker stop does not result in an immediate restart).

    See this documentation for more details: https://docs.docker.com/config/containers/start-containers-automatically/

    Note: I do not recommend a restart policy for containers running within swarm mode. I've seen scenarios, e.g. host out of memory, where both swarm mode and the docker engine attempt to restart the container and it's best to let swarm mode recreate a new container, possibly on another host.

    0 讨论(0)
提交回复
热议问题