Docker Compose
Run multi-service stacks (app + db + cache) with one file.
- docker compose
- compose up
- compose logs
- multi-service
- compose down
Docker Compose
Run multi-service stacks (app + db + cache) with one file.
Commands
| Command | What it does |
|---|---|
docker compose up -d | Start the whole stack detached |
docker compose ps | Status of stack services |
docker compose logs -f api | Follow one service's logs |
docker compose up -d --build | Rebuild images then restart |
docker compose down -v | Stop stack and delete its volumes |
Example
docker compose up -d --build
docker compose ps
docker compose logs -f api
FAQ
How do services reach each other?
By service name over the compose network, e.g. postgres://db:5432 — no published ports needed internally.
down vs down -v?
Plain down keeps volumes (your data survives); -v deletes them — only for disposable dev data.
常见问题
How do services reach each other?
By service name over the compose network, e.g. postgres://db:5432 — no published ports needed internally.
down vs down -v?
Plain down keeps volumes (your data survives); -v deletes them — only for disposable dev data.
Docker
Docker Install and Setup
Verify the Docker engine, configure context, and check versions.
Docker Images
Pull, list, tag, inspect, and remove images confidently.
Docker Containers
Run, list, stop, and clean up containers in daily work.
Docker Run Options
The flags that matter: detach, ports, env, volumes, limits.