Files
nexus/wiki/concepts/Docker-Compose.md
2026-04-16 20:05:13 +08:00

44 lines
979 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Docker-Compose"
type: concept
tags: [docker, container, orchestration]
---
## Definition
Docker ComposeDocker Compose V2是 Docker 官方提供的多容器 Docker 应用定义和运行工具,通过 `docker-compose.yml` 文件声明式配置多容器应用。
## Core Components
- **Services**:定义每个容器配置
- **Volumes**:持久化数据卷
- **Networks**:容器网络配置
- **Profiles**:条件性启动服务
## Key Features
- 单一命令启动整个应用:`docker compose up`
- 服务依赖管理
- 环境变量配置
- 端口映射
- 卷挂载
## Syntax Example
```yaml
services:
web:
image: nginx
ports:
- "80:80"
volumes:
- ./html:/usr/share/nginx/html
```
## Use Cases
- 本地开发环境搭建
- 微服务应用部署
- CI/CD 测试环境
- Home Lab 应用(如 Navidrome、Pi-hole 等)
---
## Related
- [[Navidrome]] — 使用 Docker-Compose 部署的服务
- [[Docker]] — 容器运行时