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.
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.
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.
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.
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.