979 B
979 B
title, type, tags
| title | type | tags | |||
|---|---|---|---|---|---|
| Docker-Compose | concept |
|
Definition
Docker Compose(Docker Compose V2)是 Docker 官方提供的多容器 Docker 应用定义和运行工具,通过 docker-compose.yml 文件声明式配置多容器应用。
Core Components
- Services:定义每个容器配置
- Volumes:持久化数据卷
- Networks:容器网络配置
- Profiles:条件性启动服务
Key Features
- 单一命令启动整个应用:
docker compose up - 服务依赖管理
- 环境变量配置
- 端口映射
- 卷挂载
Syntax Example
services:
web:
image: nginx
ports:
- "80:80"
volumes:
- ./html:/usr/share/nginx/html
Use Cases
- 本地开发环境搭建
- 微服务应用部署
- CI/CD 测试环境
- Home Lab 应用(如 Navidrome、Pi-hole 等)