dockerdocker-composedocker-swarm

Clarification on Docker Compose's `start_period` parameter


I am trying to understand how the start_period works with Docker Compose. If we have the following as a Healthcheck:

--start-period=60s --retries=2

Does that mean that Docker Swarm will try twice, each time wait 60 sec before considering the container Unhealthy?

Thank you.


Solution

  • Yup exactly.

    From healthcheck docs:

    Start period provides initialization time for containers that need time to bootstrap. Probe failure during that period will not be counted towards the maximum number of retries. However, if a health check succeeds during the start period, the container is considered started and all consecutive failures will be counted towards the maximum number of retries.