Docker gives you a way to control startup, while codifying that one container depends on others.

An example is most helpful here:

services:
  web:
    build: .
    depends_on:
      db:
        condition: service_healthy
        restart: true
      redis:
        condition: service_started
  redis:
    image: redis
  db:
    image: postgres:18
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 10s
      retries: 5
      start_period: 30s
      timeout: 10s

With this configuration, services are created in dependency order: web will come up only after redis is started and db healthy, as defined in the healthcheck.

For web applications, this is good! The web app can’t do much if its data stores aren’t online. These conditions codify that.

Docs