1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [depends\_on](<https://delaparra-services.nl/knowledge-hub/depends-on>)

  

Category: Docker 

# depends\_on

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

## What is depends\_on?

 

depends\_on: Declares startup order between services. With a condition it can wait until a dependency is healthy. In Docker Compose, ` depends_on ` controls the order services start in. If ` web ` depends on ` db `, Compose starts the database container first. On its own, it only waits for the container to start, not for the service inside to be ready. A database container can be running for several seconds before it accepts connections, and your app may crash in the meantime.

 

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 depends\_on

  

### What should you keep in mind with depends\_on?

 

Add a health check to the database service and use ` condition: service_healthy `. Compose then waits until the health check passes before starting the app. Even so, build your application to retry connections for a short while at start-up. In production, on Kubernetes or elsewhere, start order is not guaranteed at all, and an app that retries gracefully survives restarts of its dependencies.

    

### What does an example of depends\_on look like?

 

```
services: web: depends_on: db: condition: service_healthy
```

 

## At a glance

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

 

## More Docker terms

 

- [container](<https://delaparra-services.nl/knowledge-hub/container>) 
- [container DNS](<https://delaparra-services.nl/knowledge-hub/container-dns>) 
- [COPY](<https://delaparra-services.nl/knowledge-hub/copy>) 
- [digest](<https://delaparra-services.nl/knowledge-hub/digest>) 
- [Docker Hub](<https://delaparra-services.nl/knowledge-hub/docker-hub>) 
- [ENTRYPOINT](<https://delaparra-services.nl/knowledge-hub/entrypoint>)

 

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

 

## 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/depends-on/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/depends-on)
