Jump to content

Linux/Docker/Healthcheck: Difference between revisions

From Wiki
Marcluer (talk | contribs)
Created page with "== docker-compose.yml == <pre> service: web: image: ... ... healthcheck: test: interval: (default: 30s) timeout: (default: 30s) start-period: (default 0s) start-interval: (default: 5s) retries: (default: 3) depends_on: database: condition: (service_started, service_healthy) restart: true </pre> Category:Linux/Docker Category:Linux"
 
Marcluer (talk | contribs)
mNo edit summary
Line 8: Line 8:
       test:   
       test:   
       interval:        (default: 30s)
       interval:        (default: 30s)
       timeout:        (default: 30s)
       timeout:        (default: 30s)
       start-period:    (default 0s)
      retries:        (default: 3)    # number of consecutive failures before unhealthy
       start-interval:  (default: 5s)
       start-period:    (default 0s)   # grace period after start, failures will not count towards consecutive failures
      retries:        (default: 3)
       start-interval:  (default: 5s)   # time between checks, during start-period
 
     depends_on:
     depends_on:
       database:
       database:
Line 18: Line 19:
</pre>
</pre>


== Exit codes ==
* 0: success
* 1: failure / unhealthy




[[Category:Linux/Docker]]
[[Category:Linux/Docker]]
[[Category:Linux]]
[[Category:Linux]]

Revision as of 09:45, 19 June 2025

docker-compose.yml

service:
  web:
    image: ...  
    ...
    healthcheck:
      test:  
      interval:        (default: 30s)
      timeout:         (default: 30s)  
      retries:         (default: 3)    # number of consecutive failures before unhealthy
      start-period:    (default 0s)    # grace period after start, failures will not count towards consecutive failures
      start-interval:  (default: 5s)   # time between checks, during start-period

    depends_on:
      database:
        condition:     (service_started, service_healthy)
        restart: true

Exit codes

  • 0: success
  • 1: failure / unhealthy