What is Docker Compose?
Docker Compose is a tool that helps you run and manage multi-container Docker applications with a single configuration file.
Without Compose → You run each container manually using docker run.
With Compose → You describe everything (services, networks, volumes) in one YAML file, then start everything with one command:
bash
docker-compose up
Think of it as a project manager for containers.
Why Use Docker Compose?
- Run multiple containers together (e.g., app + database).
- One command starts/stops everything.
- Easy to share setup (just send the docker-compose.yml file).
Works the same on your machine, server, or cloud.
Example use cases:A web app (React frontend + Node.js backend + PostgreSQL database).
A data pipeline (Kafka + Spark + Grafana).
A local development environment (Nginx + PHP + MySQL).
Key Concepts
- services → Containers (like web, redis).
- image → Which Docker image to use.
- ports → Maps host port → container port (5000:5000).
- volumes → Persist data or share code.
- depends_on → Start order (e.g., web depends on redis).
Top comments (0)