What is described in `docker-compose.yml`?
docker-compose.yml describes the composition and configuration of all services that should work together in one environment. The file is not responsible for building images, but for how and with what parameters these containers will be run.
It usually specifies:
1. Services (services)
For example: app, db, redis. Each service is a separate container.
2. Images or builds (image / build)
Either a ready image is used, or a path to a Dockerfile is specified.
3. Ports (ports)
How the container is accessible from outside - for example 3000:3000.
4. Environment variables (environment)
Passwords, startup modes, application settings.
5. Volumes (volumes)
So that data is not lost when containers restart.
6. Networks (networks)
Compose creates a shared network so that containers see each other by name.
In the end, docker-compose.yml is a declarative description of what to run, how to run it, and what it will be connected to within a single system.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.