11

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.

Pēteris Caune
  • 43,578
  • 6
  • 59
  • 81
Cuthbeorht
  • 157
  • 1
  • 1
  • 6

1 Answers1

20

Yup exactly.

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.

Woodstock
  • 22,184
  • 15
  • 80
  • 118
  • And so it does not keep the service from starting ? It does not offer a way to delay the start of a service so as to give time to another service ? – Stephane Oct 16 '20 at 17:08
  • 1
    @Stephane, I think you're looking for `deploy.restart_policy.delay`. – SamK Aug 23 '22 at 11:42
  • FYI here are the docs: https://docs.docker.com/engine/reference/builder/#healthcheck – mattyb Jul 25 '23 at 20:52