1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [healthcheck (compose)](<https://delaparra-services.nl/knowledge-hub/healthcheck-compose>)

  

Category: Docker 

# healthcheck (compose)

  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    

## What is healthcheck (compose)?

 

healthcheck (compose): Defines a health probe for a service directly in the Compose file, overriding any in the image. In Docker Compose, ` healthcheck ` defines how to test whether a service is ready, directly in the Compose file. For a PostgreSQL service, ` pg_isready ` is a common test; for MySQL, ` mysqladmin ping `. It overrides any health check in the image, and it is what makes ` depends_on ` with ` condition: service_healthy ` work. Your app container then waits until the database really accepts connections, instead of crashing on start-up.

 

Definition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)

 

## Frequently asked questions about healthcheck (compose)

  

### What should you keep in mind with healthcheck (compose)?

 

Set ` interval `, ` timeout `, ` retries ` and ` start_period ` to fit the service. Databases can take a while to start, especially the first time when they initialise their data folder, so a generous ` start_period ` avoids false failures. ` docker compose ps ` shows the health status of each service, which is the first thing to check when a stack does not come up properly.

    

### What does an example of healthcheck (compose) look like?

 

```
services: db: image: postgres:16 healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 10s retries: 5
```

 

## At a glance

   CategoryDocker Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026

 

## More Docker terms

 

- [EXPOSE](<https://delaparra-services.nl/knowledge-hub/expose>) 
- [FROM](<https://delaparra-services.nl/knowledge-hub/from>) 
- [HEALTHCHECK](<https://delaparra-services.nl/knowledge-hub/healthcheck>) 
- [host](<https://delaparra-services.nl/knowledge-hub/host>) 
- [image](<https://delaparra-services.nl/knowledge-hub/image>) 
- [layer](<https://delaparra-services.nl/knowledge-hub/layer>)

 

[All terms starting with H](<https://delaparra-services.nl/knowledge-hub#letter-h>)

 

## Skills

 

- ### Docker Project Foundations

 

Use this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a database or cache dependency, or running services without host-level installs. Covers Dockerfile, compose.yaml, and .dockerignore creation with Docker best practices.

 [View skill](<https://delaparra-services.nl/skills/docker-project-foundations>) [Download zip](<https://delaparra-services.nl/skills/docker-project-foundations/download>) 
- ### Docker Compose Patterns

 

Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.

 [View skill](<https://delaparra-services.nl/skills/docker-compose-patterns>) [Download zip](<https://delaparra-services.nl/skills/docker-compose-patterns/download>) 
- ### Docker Build Strategies

 

Use this skill when writing, reviewing, or optimizing Dockerfiles, even if the user just says their image is too large, their build is slow, or they need to harden a container for production. Covers multi-stage builds, layer caching, .dockerignore, non-root users, and image size optimization.

 [View skill](<https://delaparra-services.nl/skills/docker-build-strategies>) [Download zip](<https://delaparra-services.nl/skills/docker-build-strategies/download>)

 [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/healthcheck-compose/skills.zip>)

 

## Manuals

 

- [Docker for your Laravel app](<https://delaparra-services.nl/manuals/docker-voor-je-laravel-app>) 
- [Deploying a Laravel app](<https://delaparra-services.nl/manuals/je-laravel-app-online-zetten>)

 

## Related services

 

- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)

Perhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.

 

## Need any help?

 

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.

  [Get in touch](<https://delaparra-services.nl/availability>)

[HTML version](https://delaparra-services.nl/knowledge-hub/healthcheck-compose)
