Docker Compose for Multi-service Apps
A real app is almost never a single container — there is an API service, a database, and sometimes a cache. Instead of running each with a separate docker run command and wiring them by hand, a compose.yaml file describes all the services together, and docker compose up brings them all up at once. I
Docker Compose is like one stage manager who starts the whole show together: all the actors come on stage together and know each other by role name, not by seat number.
- service
- The definition of one container inside compose — which image or build to use, which environment variables, ports, and volumes. Each service comes up as its own unit but connected to the rest.
- compose file
- A YAML file describing all of the app's services, networks, and volumes in one place, so docker compose up can bring everything up together in a reproducible way.
- depends_on
- A setting that controls start order only: Compose starts the depended-on service first. It does not wait for that service to be ready to accept requests — for that you need a healthcheck with condition: service_healthy.