Docker Compose uses a YAML file to define and run a multi-container application stack. In end-to-end testing, it assembles microservices, databases, dependencies, and test-accessible ports into a repeatable environment. section 7.4.1 section 7.4.3
A Compose service definition commonly specifies:
- build, which identifies the Dockerfile path used to build a service image. section 7.4.2
- environment, which supplies configuration such as application ports, database URLs, and runtime modes. section 7.4.2 section 7.4.6
- depends_on, which expresses prerequisite services; healthcheck, which prevents startup readiness from being confused with application readiness. section 7.4.2
- ports and volumes, which expose services externally and mount local resources into containers. section 7.4.2
Compose a test database and services
Place docker-compose.yml and database migration files under an end-to-end test module. Define a MySQL 8.0.30 service with a mounted init.sql file, a root password, and a health check that retries mysqladmin ping up to 20 times. The initialization script creates payments and orders databases; then run the stack with `cd resources && docker-compose up`. Add payment and order services with Dockerfile builds, dependency conditions, exposed ports, and service-specific connection settings. section 7.4.3 section 7.4.4 section 7.4.6
Use the application-stack diagram to inspect how the database and microservices are assembled for the end-to-end test suite. section 7.4.1














